Wednesday, 07 January 2009
Home
Forum
Main Menu
Home
News
Forum
Documentation
Download
Links
Administrator
Login Form
Welcome,
Guest
. Please
login
or
register
.
January 07, 2009, 05:16:52 PM
Username:
Password:
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Forgot your password?
Sprite Collision
DSLua Community
Welcome,
Guest
. Please
login
or
register
.
January 07, 2009, 05:16:52 PM
1724
Posts in
316
Topics by
10131
Members
Latest Member:
dertUntot
Home
Help
Search
Login
Register
DSLua Community
|
General DS Programming Chats
|
Code Hashing
|
Sprite Collision
« previous
next »
Pages:
[
1
]
Print
Author
Topic: Sprite Collision (Read 2809 times)
Zhen
Waxing Crescent
Posts: 57
Sprite Collision
«
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"
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"
Logged
waruwaru
Administrator
Waxing Crescent
Posts: 94
Re:Sprite Collision
«
Reply #1 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
Logged
Zhen
Waxing Crescent
Posts: 57
Re:Sprite Collision
«
Reply #2 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
Logged
waruwaru
Administrator
Waxing Crescent
Posts: 94
Re:Sprite Collision
«
Reply #3 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
Logged
franck569
Waxing Crescent
Posts: 12
Re: Sprite Collision
«
Reply #4 on:
June 06, 2006, 04:48:15 PM »
me too :p
Logged
crowcity
New Moon
Posts: 3
Re: Sprite Collision
«
Reply #5 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?
Logged
daltonlaffs
Waxing Gibbous
Posts: 340
Freaking Insane
Re: Sprite Collision
«
Reply #6 on:
February 11, 2007, 06:22:11 PM »
Quote from: 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?
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...
Logged
Code:
-- Bored? Read code line below.
-- Bored? Read code line above.
^^ That works, I SWEAR! ^^
Jeremysr
Waxing Gibbous
Posts: 254
Re: Sprite Collision
«
Reply #7 on:
February 11, 2007, 06:24:59 PM »
Here's a tutorial...
http://www.palib.info/wiki/doku.php?id=day6#sprite_collisions
Logged
crowcity
New Moon
Posts: 3
Re: Sprite Collision
«
Reply #8 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!
Logged
Jeremysr
Waxing Gibbous
Posts: 254
Re: Sprite Collision
«
Reply #9 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
Logged
jester
First Quarter
Posts: 123
Jester Corp DS Logo
Re: Sprite Collision
«
Reply #10 on:
February 12, 2007, 06:37:19 PM »
excellent work
Logged
CURRENT PROJECT:
JesterCorp DS- 2D FIGHTING GAME!!! Due out August 19th 2007!!!Having Sprite Issues but Toast is helping me ALOT
Pages:
[
1
]
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
DSLua - Best scripting language for Nintendo DS
-----------------------------
=> News and Announcements
=> Examples/Tutorials
=> Home-brew/Hacks/Games/Projects
=> Hardware and Equipments
=> Need Help?
=> Bugs & Suggestions
-----------------------------
General DS Programming Chats
-----------------------------
=> Code Hashing
=> Chat Room
=> Test Area
Powered by SMF 1.1 RC2
|
SMF © 2001-2005, Lewis Media
(C) 2009 DSLua
DSLua - Best scripting language for Nintendo DS home-brew!