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! / Stage Sprite Collision

Author
Message
Gaelbin
15
Years of Service
User Offline
Joined: 16th Feb 2009
Location:
Posted: 18th May 2009 23:57
Hey guys, so I have a new problem. I have been experimenting with sprite collision and have one problem. Is there a way to have sprite collision within a sprite? That is, I have a stage that is an image. It is comprised of a pink back ground and blocks. Is there a way so that the character sprite I have can collide with a block sitting in the way and ignore the rest of the pink background of the sprite? Here attached is the image I am using.

Thanks for any advice!

Attachments

Login to view attachments
Caleb1994
15
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 19th May 2009 07:24
supposing your using dbc. you can use memblocks. you would need another image that has only 2 colors on it (Collidable and not collidable) so then you would make a memblock of the image and check the pixel when you try and move and if that pixel is the color with collision then don't move there.

Try and contact Ashinga. he put together the memblock collision for the DarkNoobs game currently being made(I think) or just contact any of them doing darknoobs sense they have been working with it.

New Site! Check it out \/
Deego
15
Years of Service
User Offline
Joined: 21st May 2008
Location:
Posted: 24th May 2009 20:36
Alternatively, if you keep your layout and loading of sprite elements organized, loading and creating similar elements with sequential numbers, you could check sprite collision within a range with:



It might not be feasible depending on how you are organizing your levels, but if you are using a series of rooms like Metroid or Legend of Zelda it's highly doable. If you can set up the loading of a level into a function using data blocks as reference, you can get your program to do this automatically.

Login to post a reply

Server time is: 2024-03-28 12:11:37
Your offset time is: 2024-03-28 12:11:37