|
Title: Sprite Collision Post by: Zhen on April 18, 2006, 10:36:59 AM I am working in a gradious-esque shooter. And now that I have the ship moving and shoting, the next step is "kill aliens" :D
So, .. uhmm, sprite Collision...err. The easy solution is make bounding boxes with the sprite sizes. But for a more realistic simulation, I want a perfect pixel collision. Like: http://www.studentsofgamedesign.com/VBTutorials/PixelPerfectCollision.html But with DSLua, i'll need two colour masks for xor. Or access to sprite pixel data to construct the mask. Also, is DSLua going to have sprite collision in the API? It'll be more fast than use the floating aritmethic of Lua. Any ideas, Greets, Zhen a.k.a "Luis" Title: Re:Sprite Collision Post by: waruwaru on April 18, 2006, 05:04:51 PM Hmmm. I was thinking to maybe implement bounding boxes for sprites, definitely not something as good as pixel perfect collision. :) From what I read, DS isn't really good at "blitting bits". I will look into it
Waruwaru Title: Re:Sprite Collision Post by: Zhen on April 18, 2006, 09:50:24 PM I was searching more information,
http://scorpioncity.com/dg_sprites.html I think that is not need blitting nothing, as last article that I link do. When the FrameStrip is created, the bitmask can be created also, out of video memory. The bitmask is not a surface only bytes. To check the collision we obtain the bitmasks that can collide and perform and bit-and between masks. Zhen Title: Re:Sprite Collision Post by: waruwaru on April 19, 2006, 04:20:48 AM Maybe I can make it optional to load/create a bitmask for the sprite frames. I think if I default to always be on, then it might eat up much memory for people who don't need it, and makes init slower (need to create bitmask). On the DS, memory/vrams are pretty scarce, plus. I don't think DS hardware has any quick memory copy/and/or functions, so I would have to write some. I am curious to see what the performance is though.
Thanks, Waruwaru Title: Re: Sprite Collision Post by: franck569 on June 06, 2006, 04:48:15 PM me too :p
Title: Re: Sprite Collision Post by: crowcity on February 11, 2007, 04:59:58 PM Does this mean there are no built-in functions for collision detection in DSlua? That would be a nightmare!!!!!! How are other people getting round this?
Title: Re: Sprite Collision Post by: daltonlaffs on February 11, 2007, 06:22:11 PM Does this mean there are no built-in functions for collision detection in DSlua? That would be a nightmare!!!!!! How are other people getting round this? There is no current function in DSLua for sprite collision, but I have a method: Code: -- DSLua code that is capable of collision detection! -- First, define the X and Y of the sprite (for mathmatical collison detection) X = 32 Y = 32 -- Now, define where the sprite is located on the screen SX = 0 SY = 0 -- The X and Y of the colliding object (this is a big object!) OX = 64 OY = 64 -- Current X and Y of the colliding object. Needs to be updated regularly. OSX = 96 OSY = 0 -- Now perform mathematic calculations to see if it has collided or not, and store results in a true/false value... I don't really wanna type all this out, you can probably get it yourself... basically, if it collided, make a value true, else it's false... I'll post it later if you need it, but I'm kinda tired now... zzz... Title: Re: Sprite Collision Post by: Jeremysr on February 11, 2007, 06:24:59 PM Here's a tutorial...
http://www.palib.info/wiki/doku.php?id=day6#sprite_collisions Title: Re: Sprite Collision Post by: crowcity on February 12, 2007, 01:30:44 PM Cheers for responding so quickly. I guess I've been spoiled being used to bitmask collisions using Gamemaker (gamemaker.nl). I nearly had a fit when I started looking into developing games for the DS! It's so hard! I'm thinking of the bounce when two objects collide, trying to make it true to life. Thanks for the PALib link. I was kind of hoping to just develop with DSLua but I guess it's not quite ready yet. What's the betting I finally get my head round devkitPro and PALib and then DSLua gets full functionality!
Really admire what you're doing here. Wish I could help but my programming skills aren't up to a whole lot. The tutorials rock too. DSLua is very exciting! Title: Re: Sprite Collision Post by: Jeremysr on February 12, 2007, 03:31:18 PM DSLua has many games made for it, I kinda meant to use that tutorial with DSLua code :P
Title: Re: Sprite Collision Post by: jester on February 12, 2007, 06:37:19 PM excellent work
|