Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / sprite collision and sprite hit

Author
Message
EightYearRecoil
20
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 13th Apr 2003 04:43
Could somebody tell me the difference between a sprite collision and a sprite hit? And maybe an example of each or something.
Thanks

Eight Year Recoil
Steven Craft
20
Years of Service
User Offline
Joined: 15th Apr 2003
Location:
Posted: 16th Apr 2003 04:20
Hey there, the two commands are pretty much self explanatory,
SPRITE HIT takes two arguments, the two sprites you wish to check collisions on. For example:
SPRITE HIT(1,2) will check if sprite 1 is HITTING sprite 2, this means its checks if sprite 1 is TOUCHING (not overlapping) sprite 2. If it IS TOUCHING, it will return 1.

SPRITE COLLISION works the same way, but this time isn't affected if the sprites and touching, the sprites have to be actually overlapping!

One other thing to note, if you dont put in a second argument, and instead put in 0, e.g.
SPRITE HIT(1,0) or SPRITE COLLISION(1,0)
It will return 0 if there are no collisions / hits, or if there is a collision/hit, it will return THE NUMBER OF THE SPRITE ITS COLLIDING with.

Hope this helps,

Steven John

EightYearRecoil
20
Years of Service
User Offline
Joined: 7th Apr 2003
Location: United States
Posted: 16th Apr 2003 04:23
Thanks. I pretty much knew what each one did, but they seemed mostly the same. That clarifies it a lot(sprite hit is when it's only touching). So thanks again, I appreciate it.

Eight Year Recoil

Login to post a reply

Server time is: 2024-03-29 11:59:08
Your offset time is: 2024-03-29 11:59:08