Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: hellninjas on November 13, 2011, 05:20:18 pm

Title: COLLISION
Post by: hellninjas on November 13, 2011, 05:20:18 pm
ok i need help with my collision... I want to make a normal field, with a line in the center of the screen, the ball can only land on top of the line...
It cannot jump through it... Or better yet, how would I do collision in general? Help!
Title: Re: COLLISION
Post by: BalancedFury on November 13, 2011, 05:38:03 pm
Ask my brother TBO_Yeong :P
He's dont that a lot of time :D
Title: Re: COLLISION
Post by: epic7 on November 13, 2011, 06:20:34 pm
Just so a ball doesn't fall through a line?
I have no idea of to what extent the advancedness of what you want is... But whatever.
If assuming that's what you want, but I might be wrong :P
Just do something like
If y-sprite height<25
Y++
End
If the line is at 25 y axis.

For collision in general to check if 2 things are touching I usually do
X is x of first object
Y is y of first object
A Is x of second
B is y of second

If abs(X-A)<6
If abs(Y-B)<6
Stuff
End
End

That'll check if if the 2 objects are less than six pixels apart.


Title: Re: COLLISION
Post by: C0deH4cker on November 13, 2011, 10:05:08 pm
Well, you'd have to do this instead:

Line(0,25,96,25)
If Y-(Sprite Height)<25
.Whatever
End
Title: Re: COLLISION
Post by: epic7 on November 13, 2011, 10:07:55 pm
Oh yeah. But if you're holding the screen upside down... :P
Title: Re: COLLISION
Post by: C0deH4cker on November 13, 2011, 10:19:54 pm
then it would move down until its top was even with the line ;)
Title: Re: COLLISION
Post by: epic7 on November 13, 2011, 10:22:38 pm
If you were Holding the screen upside down and the object was coming up from the bottom of the screen and the sprite was rotated 180°. Then it would work!
Title: Re: COLLISION
Post by: hellninjas on November 14, 2011, 02:32:04 pm
Well thanks for the help, I've been needing this for some of my games that had gravity in it...