Android Cant Jump and Run

V

Verilyzed

Guest
Hi,
My Name is Colin and my Game doesnt work as I like.

I got a simple way to move my object. Also i got a simple way to jump.

Objects that you Need to know:
obj_left (to walk to left)
obj_right (to walk to right)
obj_up (to jump)
obj_player (player)

Walk Way:
In both objects is one simple text in "Left Button" Event: "obj_player += 5;" and "obj_player -= 5;"

Jump Way:

Create: j = 0;



Step:
///Step Event
//On Screen

if (global.SETTINGcontrol == 0) <-- This you can Ignore. Its for postion and controll setting
{
x = view_xview[0] + 1024;
}

//Jumping Effect
if (j >= -10) j -= 1;
obj_player.y -= j;

if (obj_player.y >= global.ybottom)
{
obj_player.y = global.ybottom;
j = 0;
}



Left Button:
if (obj_player.y == global.ybottom)
{
j = 12;
}


And if I want to walk it works and if i want to jump it works.

BUUUT if i want to walk AND Jumping in walk it doesnt work!!! The object is only moving on x-postion and not Jumping.

Anyone know how to solve? :)
 

SeraphSword

Member
A couple questions:

1. What version of GMS are you using?
2. From what I can see you are using the same input (Left Button which I assume means left mouse button) for both moving and jumping. How are you testing clicking two objects at once?

Without more information on the structure of your game it's a little tough to say what you should change. It's possible that when you are moving left or right, the y position is being altered by something, which would nullify the jump.
You may also want to double check your code, since I think you may have a few errors in there. It's possible you just copied it wrong when posting it here, but some of this looks like it shouldn't work at all (for instance, your Walk just changes obj_player by 5, when it probably should be obj_player.x).

Good luck.
 
V

Verilyzed

Guest
A couple questions:

1. What version of GMS are you using?
2. From what I can see you are using the same input (Left Button which I assume means left mouse button) for both moving and jumping. How are you testing clicking two objects at once?

Without more information on the structure of your game it's a little tough to say what you should change. It's possible that when you are moving left or right, the y position is being altered by something, which would nullify the jump.
You may also want to double check your code, since I think you may have a few errors in there. It's possible you just copied it wrong when posting it here, but some of this looks like it shouldn't work at all (for instance, your Walk just changes obj_player by 5, when it probably should be obj_player.x).

Good luck.
1. My GMS Version is 1.4.1404
2. Its a Smartphone Android Project. Normal, i got 10 fingers :D And with them i can click both at same time xD
 
Top