|
7 registered members (fairtrader, Quad, miwok, Martin_HH, AndrewAMD, alibaba, dpn),
581
guests, and 0
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: 2D Movement
[Re: Rei_Ayanami]
#271467
06/13/09 11:10
06/13/09 11:10
|
Joined: Jun 2008
Posts: 402 Germany
sebbi91
Senior Member
|
Senior Member
Joined: Jun 2008
Posts: 402
Germany
|
please show your code because without it we cant say why it gets faster! I think its a problem with your walkvariable , maybe a variable that gets bigger if you hit the walkkeys!
3D-Gamestudio A8 - Commercial
|
|
|
Re: 2D Movement
[Re: Rei_Ayanami]
#271474
06/13/09 11:47
06/13/09 11:47
|
Joined: Nov 2008
Posts: 946
the_clown
User
|
User
Joined: Nov 2008
Posts: 946
|
Try something like this:
var jumping = 0;
function jump()
{
if(jumping == 0)
{
jumping = 1;
x = panel.pos_x + 200;
}
while(key_space)
wait(1);
}
//// later in the code (in a loop):
...
if(jumping)
{
if(panel.pos_y > x) // x is the maximum jump height, panel the panel
{
panel.pos_y -= 20*time_step;
panel.pos_y = maxv(panel.pos_y,x);
}
else
jumping = 0;
}
else
{
... // add gravity here
No guarantuee that it works, wrote it without testing.
|
|
|
|