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.

Dark GDK / 2D sprite collision also text ontop of 2d sprites

Author
Message
Vesper
15
Years of Service
User Offline
Joined: 22nd Nov 2009
Location:
Posted: 22nd Nov 2009 10:40
So my issues are two fold: 1.) When dealing with 2d collisions (on my map its a 20x15 map with the borders consisting of 32x32 black sprite boxes) when collision is checked for it only returns 1. Which would be fine except that if i jump while touching a side wall i fall through the floor. and 2.) how do I draw text on top of a sprite. When i do it the text is always on the bottom...
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 22nd Nov 2009 18:26
to draw text on the top of a sprite use dbDrawSpritesFirst();
to go back to normal use dbDrawSpritesLast();

even tho dbDrawSpritesFirst sometimes screw up some 3d scenes, i dunno but i had much troubles while using 2d UI and 3d game, somehow the sprites were drawn behind the 3d scene or something, i dont really know, but anyway, i think it will do the trick.

and i don't really get your first question

Caleb1994
16
Years of Service
User Offline
Joined: 10th Oct 2008
Location: The Internet you idiot!
Posted: 23rd Nov 2009 01:51
For anything collision related like this, we need to know how you are doing the collision(i.e. are you just check if the tile is solid or are you using pixel collision or sprite collision or what) even better would be some codes.

New Site! Check it out \/
Vesper
15
Years of Service
User Offline
Joined: 22nd Nov 2009
Location:
Posted: 23rd Nov 2009 01:53
I got the collision thing working but allow me to explain for clarity. My old collision code checked for a collision with my player and stored the id of the other object in a variable it was setup as (hit=dbSpriteCollision(player_id,0) then I used the hit variable to check if the other object was in a range of objects held for ground, walls, and ceilings exclusivley. Now the issue was that If i was at a corner where he was hitting a wall & a Floor tile then he became confused because only one collision was being read. So if i jumped i could A.) Phase through the wall(if it was reading the floor collision) or B.)fall through the floor(if it was reading the wall) I fixed this by adding a new sprite that moves to key positions around the played and checks for collisions. that way i can check specific positions and know if its a wall celing or floor and only check one at a time then act accordingly.

But now a new issue has arisen. First let me give u some source:
Ground collision Check Codeid+1 means satalite)

Jumping Code:

Falling Code:As seen at bottom of jumping code

Constant Variables Used in the above:


now the issue is that when i press up to jump he moves just eneough pixels that the satalite on the bottom is on pixel away from the floor. then he just hangs there, he wont fall or anything. Left and right movement still works fine, so I assume its something in my jump code(left and right movement is handled in the same was as floor collision checking in that it cycles 4 positions and returns the hit value and if it hits then he moves to a specified x position) Included is a pic of whats happening. I have no idea whats wrong here any ideas?

Attachments

Login to view attachments
Vesper
15
Years of Service
User Offline
Joined: 22nd Nov 2009
Location:
Posted: 23rd Nov 2009 02:16
For better reference i packaged a release of what its doing so if u want to see for your self, controls are simple left arrow right arrow and up to jump

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-24 17:40:50
Your offset time is: 2024-11-24 17:40:50