Omnimaga
Calculator Community => TI Calculators => Axe => Topic started by: parserp on October 29, 2011, 02:03:37 pm
-
So, for my game swords, I am having trouble with collisions with things like speed up/downs, keys, and other non-moving objects. D:
Should I use a X,Y coordinate to do this, or some other method? And how would I go about doing that?
And what collision checks should I use for moving objects? (enemies). any help would be great. ;D
-
I didn't know you could even do collisions without x,y coords...
-
I'm a bit confused by your question, you are having trouble with collisions for non moving objects? O.o
-
Yes: it is for my game: http://ourl.ca/13637
I think that should do it...
-
But non moving objects never move, why would they need to collide with anything?
-
Perhaps the player can collide with a stationary object, such as a wall?
There are multiple methods, which depend on how you store the level. Is it a buffer you pixel-test, or is it a tilemap that's stored somewhere?
-
oh wait, never mind, I've got the collisions with non moving objects... duh I am stupid :P
ok, so if I have an enemy at coods. ({L1+1},50) and the player is at (X,Y), for some reason it doesn't work if I do:
:{L1+1}->R
:If ((R-1)<(X)<(R+9)) and (42<Y<58)
:.do collision stuff
:End
but it does the collision stuff even if there's not a collision. :(
-
Ah, you are falling into a common trap by assuming Axe does calculations in the normal order, where in fact it does them left to right. The expression 42<Y<58 will *not* return true if Y is between 42 and 58 because 42<Y is evaluated first to either 1 or 0, and then that value is tested against 58. As you can see, this expression will always return true! Adding in some parenthesis will definitely help here :)
-
Adding in some parenthesis will definitely help here :)
He has parenthesis. ;)
Axe uses left to right order of operations. Make sure you're using your parenthesis correctly.
Instead of "(R-1)<(X)<(R+9)," try "R-1<X and (R+9>X)."
-
oh wow, that helps A LOT. thanks guys!!!! ;D