Hiya all,
I've started very early work on a platform game in Fenix (yay!).
I've used the wonderful source from FenixOnFire: Tiles by Moogle as a base for it, as its level editor and scrolling/collisions (and animation!) would save me a ton of work.
The original source is for an 8-way top-down movement (as you may know).
I've changed this by simply altering the controls (up/down for movement become left/right and the rotating by using left/right has been remmed out).
Naturally, the next step is to get jumping & falling in there. I've had a go at it but it all seems to happen way too quickly
I set 2 new local variables up: jh (jump height) and jg (a flag set to 1 when max jump height is reached).
The theory is, that on pressing A (control) with jump height less than 50, the ys variable in Tiles is adjusted upwards (my understanding is that xs & ys are the position of the player). On reaching 50, the jg flag is set, and js and ys are incremented back down (thus completing the jump via gravity).
my code for this is;
CODE
//player wants to jump
while(key(_control) and jh<50 and jg!=1 )
//move!
while(jh<50)
jh += 1;
ys += -2;
end
//walking sequence
graph = ((graph - 3)+1) % 8 +3;
//and of course not standing anymore
standing = 0;
end
//player has finished jumping, initiate fallmode
while(jh>0 and jg==1)
jh += -1;
ys += 2;
end
//player not jumping, set fallmode off
if(jh==0)
jg=0;
end
//top of jump, so allow to fall
if(jh==50)
jg=1;
end
This code is added directly after the collisions bit of the original Tiles source.
I figured that once this is sorted, I can look at ensuring the player "lands" on a platform - as currently if a player were to jump onto a lower platform, on jump completion, the player would land in mid air
Am I going the right way with this? Do you think using Tiles as a base was a good idea?
If it helps, the current source is available here (please excuse the terrible sprites, I tend to develop the engine first n work on the graphics later).
Cheers for any help
HeXy
I've started very early work on a platform game in Fenix (yay!).
I've used the wonderful source from FenixOnFire: Tiles by Moogle as a base for it, as its level editor and scrolling/collisions (and animation!) would save me a ton of work.
The original source is for an 8-way top-down movement (as you may know).
I've changed this by simply altering the controls (up/down for movement become left/right and the rotating by using left/right has been remmed out).
Naturally, the next step is to get jumping & falling in there. I've had a go at it but it all seems to happen way too quickly
I set 2 new local variables up: jh (jump height) and jg (a flag set to 1 when max jump height is reached).
The theory is, that on pressing A (control) with jump height less than 50, the ys variable in Tiles is adjusted upwards (my understanding is that xs & ys are the position of the player). On reaching 50, the jg flag is set, and js and ys are incremented back down (thus completing the jump via gravity).
my code for this is;
CODE
//player wants to jump
while(key(_control) and jh<50 and jg!=1 )
//move!
while(jh<50)
jh += 1;
ys += -2;
end
//walking sequence
graph = ((graph - 3)+1) % 8 +3;
//and of course not standing anymore
standing = 0;
end
//player has finished jumping, initiate fallmode
while(jh>0 and jg==1)
jh += -1;
ys += 2;
end
//player not jumping, set fallmode off
if(jh==0)
jg=0;
end
//top of jump, so allow to fall
if(jh==50)
jg=1;
end
This code is added directly after the collisions bit of the original Tiles source.
I figured that once this is sorted, I can look at ensuring the player "lands" on a platform - as currently if a player were to jump onto a lower platform, on jump completion, the player would land in mid air
Am I going the right way with this? Do you think using Tiles as a base was a good idea?
If it helps, the current source is available here (please excuse the terrible sprites, I tend to develop the engine first n work on the graphics later).
Cheers for any help
HeXy