ok, for my program im doing an if statement, every time i have put "keyPressed" into use instead of just "key" there is always an error,
here is my code
It's a very common mistake. As a general rule of thumb and as common courtesy, be sure to make 99.99% sure it isn't a type error or something small. We want to help you tackle good problems, not debug small errors.
You don't like em. And we don't like em. But it's your code =).
well im very new to this whole thing and am trying to learn as i go along while making something really cool, i cant tell you how many times i have allready missed things like brackets and semi colons, and for my problems ive been using the float data type mainly, do i have to use boolean? i will show you my whole code and also the reference part of the processing website is really confusing to me, and how do i add values to boolean would it just be
boolean a = 100; ????
Fail to compile due to Cannot find anything named "ypos"!
ive been using the float data type mainly,
Datatype float is the right choice if some1 doesn't wanna worry about the most adequate for a particular situation!
Java provides 8 primitive types. You can see most of it in the section Primitive in the reference page: http://processing.org/reference/
do i have to use boolean?
We can declare our own variables w/ the type we wish or need!
However, keyPressed was declared and is controlled by the Processing's framework!
So if we wanna deal w/ it, we gotta take into consideration that it's of boolean type!
... and also the reference part of the processing website is really confusing to me,
It's divided by sections rather than alphabetically ordered!
Use CTRL+F in your browser to find the API you're searching for.
... and how do i add values to boolean would it just be boolean a = 100; ????
thankyou for your help! i know im being difficult... i will read everything a little bit more finely and through all the data types, and i know about the ref page i meant the explanations to everything, simpleshapes like rect are straight forward, but class takes more infering which took me a while to figure out, i may post more questions but keep in mind this is my first time learning a computer language and that i started last week, one thing i have figured out is this is a very mathematically inclined piece of software and can be a bit tedious when there are dozens of numbers going everywhere especially in p3d ~X( but thankyou for your help and support! :D
Answers
Variable keyPressed is of type
boolean
, not achar
orint
!!! :-whttp://processing.org/reference/boolean.html
Well i might not know that!!! That's why i asked the question!!! [-X
Hey Chacka,
It's a very common mistake. As a general rule of thumb and as common courtesy, be sure to make 99.99% sure it isn't a type error or something small. We want to help you tackle good problems, not debug small errors.
You don't like em. And we don't like em. But it's your code =).
Sorry for somewhat moody reply. But posting the error message would made things a lil' clearer too: 8-X
The operator == is undefined for the argument type(s) boolean, char.
well im very new to this whole thing and am trying to learn as i go along while making something really cool, i cant tell you how many times i have allready missed things like brackets and semi colons, and for my problems ive been using the float data type mainly, do i have to use boolean? i will show you my whole code and also the reference part of the processing website is really confusing to me, and how do i add values to boolean would it just be boolean a = 100; ????
Fail to compile due to
Cannot find anything named "ypos"
!Datatype
float
is the right choice if some1 doesn't wanna worry about the most adequate for a particular situation!Java provides 8 primitive types. You can see most of it in the section Primitive in the reference page:
http://processing.org/reference/
We can declare our own variables w/ the type we wish or need!
However, keyPressed was declared and is controlled by the Processing's framework!
So if we wanna deal w/ it, we gotta take into consideration that it's of
boolean
type!It's divided by sections rather than alphabetically ordered!
Use CTRL+F in your browser to find the API you're searching for.
Have you read the link I've left for ya and you had accept as answer in my 1st reply???
http://processing.org/reference/boolean.html
thankyou for your help! i know im being difficult... i will read everything a little bit more finely and through all the data types, and i know about the ref page i meant the explanations to everything, simpleshapes like rect are straight forward, but class takes more infering which took me a while to figure out, i may post more questions but keep in mind this is my first time learning a computer language and that i started last week, one thing i have figured out is this is a very mathematically inclined piece of software and can be a bit tedious when there are dozens of numbers going everywhere especially in p3d ~X( but thankyou for your help and support! :D
it's just key=='w' of course
there are different data types
for sentences and words String
for numbers mostly float (for screen pos)
for numbers when you want to count (whole numbers) int
for when it can be only true or false it's boolean
you're doing great !