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

Author
Message
Mr Inquisitive
21
Years of Service
User Offline
Joined: 5th Feb 2005
Location: Who Cares?
Posted: 23rd Jul 2005 09:20
sorry to bother this site with this code again, but I need help with the sprite collison code at the bottom...


To be or not to be-that is the question. Whether tis nobler in the mind to suffer the slings and arrows of outragous fortune...Well you know the rest...And if you don't, YOU SHOULD!!
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Jul 2005 06:33
It's really better if you post any media that's loaded in the code. That way everybody can easily help you (rather than go through the trouble to make media of their own).

On the sprite collision what are you trying to accomplish? It looks like you're wanting the gun to be "picked up" when your character collides with the handgun. (the "or delete sprite 9" threw me off)

Instead of having "if this or this or this" on a single line you can have nested if then statements. The first if checks if the sprite exists. Inside that is another if looking for the collision of sprite 1 (remember your character sprite only uses 1 sprite now... not one for every direction). Once it sees the sprite collision it prints "Sprite hit!" (this is of course where you change the code to do whatever you want)

Hope this helps.

Mr Inquisitive
21
Years of Service
User Offline
Joined: 5th Feb 2005
Location: Who Cares?
Posted: 25th Jul 2005 07:29
yea, sorry about that...well, the reason I wanted it to delete the sprite is so that it would be gone from the screen, and any time I stepped over that same area the functions that I wanted performed wouldn't be performed again...I added in a "gun=1" code, so that I could use the inventory screen (weapons screen, (menu=2)) and have that gun in it.

To be or not to be-that is the question. Whether tis nobler in the mind to suffer the slings and arrows of outragous fortune...Well you know the rest...And if you don't, YOU SHOULD!!

Login to post a reply

Server time is: 2026-06-12 11:22:32
Your offset time is: 2026-06-12 11:22:32