Page 1 of 1

Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 9:29 am
by Hblade
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?

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 9:58 am
by DST
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.

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 10:04 am
by Bee-Ant
Code: Select all
angle=270;
directional_velocity=15;

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 10:36 am
by Bee-Ant
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

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 10:55 am
by Hblade
Thanks guys! :D Look at the gameplay in Game Dev here in a minute or 2

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 1:02 pm
by DST
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.

Re: Problem with small sprites and collisions

PostPosted: Tue Jun 29, 2010 4:07 pm
by krenisis