Hey, its 99xnwreg. Because my post is being monitored because I am new to the forum, and I want to figure this out soon, I tried you method for jumping and this is what I tried.
All what happened is that I went down about 19 pixels high, then stopped and didn't fall down. Also, in my line dbSprite(9,10,ySpriteposition9,3);, I don't know how to differentiate the x axis when jumping, so now you can only jump when you are 10 pixels across.
int gravity; //declaring gravity and jump_vector as integers
int jump_vector;
int ySpriteposition9 = 360;// the sprite ID of my character is 9. It is located default 10 pixels across, 360 pixels down( its y value); This is the equivalent to your object_position_y.
if (dbKeyState(57) == 1) //If player hits spacebar
{
gravity = -1;
jump_vector = -20; //when I set gravity at positive 20, my character went down through the floor.
jump_vector = jump_vector + gravity;
ySpriteposition9 = ySpriteposition9 + jump_vector;
dbSprite(9,10,ySpriteposition9,3);//I dont know how to differentiate the x axis please help me with that
for(int i = 2; i < 9; i++)//basic collision
{
if(dbSpriteCollision(9,i) ==1)
{
dbRotateSprite(9,180);
dbMoveSprite(9,3);
dbRotateSprite(9,0);
}
}
}
// Although the sprite will move up some pixels, it will not fall back down! Please help me.
Saying that my skill with the DarkGDK library is mediocre is generous.