Marquitos3000
Member
Hi, I´m making a plataformer game and in my character I put this in the Step event:
And this on the End Step event:
OColision is the Solid block object. And I use another object as a rectangle collision mask for the player. The problem is that when I touch the ground (made by the oColision object) my character can´t move, and the character´s origin is on it´s feet and the collision mask´s origin is down in the center.
Another problem is that when I´m falling after a jump, part of the character gets inside the block. In other words, the collision mask changes when I´m falling, but I don´t have any different sprite for the jumps and falls, apart from the walking sprite.
I don´t know where´s the problem, can somebody help me please?
Let me know if you need more information about this.
Thank you.
Moderator EDIT: Moved here from Community Tech Support forum.
GML:
var hor = keyboard_check (vk_right) - keyboard_check (vk_left)
if (hor != 0) {
if (place_free(x + hor * 2,y)) {
x += hor * 4;
}
image_xscale = hor * 2;
sprite_index = sPersonajeWalk;
} else {
sprite_index = sPersonaje;
}
if (keyboard_check_pressed(vk_up) && collision_rectangle(x-8,y,x+8,y+1,oColision,false,false)) {
vspeed = -10;
}
GML:
if (!collision_rectangle(x-8,y,x+8,y+1,oColision,false,false)) {
gravity = 0.8;
}
if (vspeed > 0) {
var ground = collision_rectangle(x-8,y,x+8,y+vspeed,oColision,false,false)
if (ground) {
y = ground.y;
vspeed = 0;
gravity = 0;
}
}
OColision is the Solid block object. And I use another object as a rectangle collision mask for the player. The problem is that when I touch the ground (made by the oColision object) my character can´t move, and the character´s origin is on it´s feet and the collision mask´s origin is down in the center.
Another problem is that when I´m falling after a jump, part of the character gets inside the block. In other words, the collision mask changes when I´m falling, but I don´t have any different sprite for the jumps and falls, apart from the walking sprite.
I don´t know where´s the problem, can somebody help me please?
Let me know if you need more information about this.
Thank you.
Moderator EDIT: Moved here from Community Tech Support forum.
Last edited: