pacdots.get(i).x is a coordinate. The second x is a variable. The difference is the distance between the two. abs() is absolute value (it makes negative values positive). So, it checks if the distance between the pacdot and the variable x is less than 10. Same for y.
@Chrisir would you be willing to walk me through a game when I am having troubles? It is due tomorrow... I have been working really hard but, have been struggling...
Answers
pacdots.get(i).x
is a coordinate. The secondx
is a variable. The difference is the distance between the two.abs()
is absolute value (it makes negative values positive). So, it checks if the distance between the pacdot and the variable x is less than 10. Same for y.what should 10 be?
pacdots.get(i).x-x
it would be better readable if you would name the 2nd
x
aspacmanX
(or so)do you know what
abs()
is? Look it up.we are talking about eat dot (
eatDot()
) here: When pacman is close to a dot, the dot gets eaten (it's removed)when it's not working try 20 instead of 10 or so
also remember to hit ctrl-t in processing more often
;-)
10 is just the distance for x and for y
when both distances are smaller than 10, pacman eats the dot
@chrisir thanks man :)
@Chrisir can you help me witha new issue?
i am trying to create a gird of squares the size of wid and heig. Like block wise. How would I do that?
@Chrisir can you recreate this with variables cellWidth and cellHeight?
you don't have a clue, uh?
@Chrisir nope, only my first year programming....
@Chrisir would you be willing to walk me through a game when I am having troubles? It is due tomorrow... I have been working really hard but, have been struggling...
sure
okay, @Chrisir my skype is classified
solved.