Problem with small sprites and collisions

Non-platform specific questions.

Problem with small sprites and collisions

Postby Hblade » Tue Jun 29, 2010 9:29 am

I've tried using specify but that doesn't work either, no matter what I do my sprite (8x8 in pixel size) always seems to fall through the floor when he reaches a fast speed of velocity or when you go up against a wall and as he suddenly falls, the wall like, grabs him in O.o

Any ideas?
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Problem with small sprites and collisions

Postby DST » Tue Jun 29, 2010 9:58 am

when you specify a velocity, it is in "pixels per frame".

So xvelocity=8; means that each frame, he will move 8 pixels.

He does not exist in-between. This is how velocity works on all platforms.

Now if he can move into the floor, he can either be below the center of the floor, resulting in a downward collision, or pass through the floor entirely. Even if you use (collision>top side>floor), he will still be at a bad angle to determine resulting physical response velocity.

What it means is that you have to either limit the speed of your actor, or increase the size of the floor so he cannot make it more than halfway through in one frame. This is true for any platformer type game. You'll have to play around with the limiting value to find one that works for you.
draw actor>

Code: Select all
if(yvelocity<8){yvelocity++;}


This would cap it at 8, because the last allowable increase is at 7, and it will add one more to 8.


As for sticking to the walls, try using separate collisions for the top/bottom and left/right side of the wall. Now on
Collision>left or right side>wall>repeat yes>

Code: Select all
int tempy=yvelocity;
PysicalResponse(MOVE_EVENT_ACTOR_ONLY, USE_CALCULATED_MASS, 1.000000, 1.000000, 0.000000, 1.000000);
yvelocity=tempy;


This will force him to stop his xvelocity, but maintain his yvelocity.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problem with small sprites and collisions

Postby Bee-Ant » Tue Jun 29, 2010 10:04 am

Code: Select all
angle=270;
directional_velocity=15;
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Problem with small sprites and collisions

Postby Bee-Ant » Tue Jun 29, 2010 10:36 am

sp1d3r wrote:there is no way to fix it its a ge problem.

Player->Collision->Left or Right side of Wall :
Code: Select all
yvelocity++;

There's a way... please, no more excuse :D
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: Problem with small sprites and collisions

Postby Hblade » Tue Jun 29, 2010 10:55 am

Thanks guys! :D Look at the gameplay in Game Dev here in a minute or 2
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: Problem with small sprites and collisions

Postby DST » Tue Jun 29, 2010 1:02 pm

sp1d3r wrote: there is no way to fix it its a ge problem.


I just explained how to fix it. Mario games follow these rules. Sonic games follow these rules. Every professional platformer follows these rules.

You have to control your actor velocities or your game won't respond right. It's true on every system ever made, it has nothing to do with ge. It's how games work..


If you keep making excuses you will never make any games at all, spider. Is that why you're here? to NOT make games?

Stop saying it can't be done and LEARN how to do it. Everyone here has been helpful in trying to teach you what to do, and you keep making excuses for things you can't do because you don't listen.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Problem with small sprites and collisions

Postby krenisis » Tue Jun 29, 2010 4:07 pm

Tutorial Database for all beginners click this link
viewtopic.php?f=4&t=8680
krenisis
 
Posts: 606
Joined: Sat Jul 25, 2009 3:27 pm
Score: 51 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron