S
shostifrosty
Guest
Hello there!
My name is Alice and I am new in the forum. ^____^ First of all I would like to thank you all for having such a nice forum with so many guidelines and threads helping people – that were very helpful for me as well, though now I am stuck (this is why I am posting here).
The point is that I was following some tutorials for an isometric platformer I am trying to develop, but I was struggling for several weeks already just trying to make the player moving around and jump using z, and the things are just not working at all.
The main problems are:
1) The animations won't work when I move around, just the first frame of the animation is showing
2) When the character jumps, the main image just stays there, and also after the second jump, it flies away Buzz-lightyear-style to infinity and beyond
3) I can't make the character jump over the objects because it works partially only (it can jump over the object and get stuck, or if it can be over the object, it will never come back to the ground again)
I will leave the code:
My version of GM is 1.4.1567
Any help will be much appreciated, for I've been struggling with this for sooo looooong with no results, and I really don't know what to do >-<
P.S: I know the code should be hilarious in the way that I mixed different tutorials and some things probably don't make any sense. I apologise for it in advance. I am no programmer – but a composer and an artist – and I did what I could xD
Thanks and see ya!
My name is Alice and I am new in the forum. ^____^ First of all I would like to thank you all for having such a nice forum with so many guidelines and threads helping people – that were very helpful for me as well, though now I am stuck (this is why I am posting here).
The point is that I was following some tutorials for an isometric platformer I am trying to develop, but I was struggling for several weeks already just trying to make the player moving around and jump using z, and the things are just not working at all.
The main problems are:
1) The animations won't work when I move around, just the first frame of the animation is showing
2) When the character jumps, the main image just stays there, and also after the second jump, it flies away Buzz-lightyear-style to infinity and beyond
3) I can't make the character jump over the objects because it works partially only (it can jump over the object and get stuck, or if it can be over the object, it will never come back to the ground again)
I will leave the code:
Code:
CREATE:
main_sprite = Ichigo_frente_drcha;
state = "idle"
z = 0
z_speed = 0
z_gravity = 0.2
z_bottom = 0
STEP
// Esto es para la profundidad
depth = -y;
h_spd = 0;
v_spd = 0;
/// Mover abajo
if (keyboard_check(vk_down)) && (place_free (h_spd+2, v_spd+1))
{
h_spd += 2;
v_spd += 1;
main_sprite = andando_frente_derecha;
image_speed = 0.1;
}
//Mover arriba
if (keyboard_check(vk_up)) && (place_free (h_spd-2, v_spd-1))
{
h_spd -= 2;
v_spd -= 1;
main_sprite = Ichigo_espalda_izquierda
image_speed = 0.1;
}
// Mover izquierda
if (keyboard_check(vk_left)) && (place_free (h_spd-2, v_spd+1))
{
h_spd -= 2;
v_spd += 1;
main_sprite = Ichigo_frente_izquierda
image_speed = 0.1;
}
// Mover derecha
if (keyboard_check(vk_right)) && (place_free (h_spd+2, v_spd-1))
{
h_spd += 2;
v_spd -= 1;
main_sprite = Ichigo_espalda_derecha;
image_speed = 0.1;
}
//Jump
jump = keyboard_check_pressed (vk_space);
switch (state)
{
case "idle":
if (jump)
{
z_speed = 4;
state = "jump"
}
if !(place_meeting(x,y,object5)) && z_bottom !=0
{
state= "jump"
z_bottom= 0;
}
break;
case "jump":
z -= z_speed
if z < z_bottom
{
z_speed -= z_gravity;
}
if z >= z_bottom
{
z = 0;
z_gravity = 0
state = "idle";
}
break;
}
var i, move_check;
for (i = abs(h_spd); i > 0; i -= 1;)
{
move_check = sign(h_spd) * i;
inst = instance_place ( x + move_check, y, object5);
if !place_meeting(x + move_check, y, object5) || z <= inst.z {x += move_check;break;}
}
for (i = abs(v_spd); i > 0; i -= 1;)
{
move_check = sign(v_spd) * i;
inst = instance_place(x, y + move_check, object5)
if !place_meeting(x, y + move_check, object5)|| z <= inst.z {y += move_check; break;}
}
DRAW
draw_sprite(main_sprite, 0, x, y + z);
if (state == "jump") draw_sprite (main_sprite, 0,x,y + z_bottom);
My version of GM is 1.4.1567
Any help will be much appreciated, for I've been struggling with this for sooo looooong with no results, and I really don't know what to do >-<
P.S: I know the code should be hilarious in the way that I mixed different tutorials and some things probably don't make any sense. I apologise for it in advance. I am no programmer – but a composer and an artist – and I did what I could xD
Thanks and see ya!
Last edited by a moderator: