• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Player wall climbing and rolling

N

NizarPlayz

Guest
Hey guy sorry to bother again so today i watched Shaun Spalding's video of how to make your player jump and walk so i did all the code in the object so the problem is my player always climb the walls i want it not to climb how can i do that here is my code
Object: obj_blueball
Event:Create
code:
//Initialize Variables
grav = 0.3;
hsp = 0;
vsp = 0;
jumpspeed = 7;
movespeed = 4;
Event:Step
Code:
//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_ground))
{
vsp = key_jump * -jumpspeed
}

//Horizontal Collision
if (place_meeting(x+hsp,y,obj_ground))
{
while(!place_meeting(x+sign(hsp),y,obj_ground))
{
x += sign(hsp);
}
hsp =0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x,y+vsp,obj_ground))
{
while(!place_meeting(x,y+sign(vsp),obj_ground))
{
y += sign(vsp);
}
vsp =0;
}

x += vsp;
y += vsp;
And i had to repost this because no one was replying to my old thread and my other problem is how can i make my player roll around my player looks like a blue ball i want my player to roll like this
 

obscene

Member
First, wrong forum! You'll get more replies in the Programming forum as people look there pretty regularly. This is for tech support (problems with the software).

On your first question, I have no idea why your player is climbing walls, sorry. If nobody else answers, reply with more information (detailed as possible as to exactly what happens and if it's consistent.)

On your second question, you can make your sprite rotate as it moves left or right by changing the image_angle. When you add hsp to x, also add hsp to image_angle and see if it looks right. If it rotates too slow or fast multiply it or divide it... example... image_angle+=hsp*0.75;
 
N

NizarPlayz

Guest
First, wrong forum! You'll get more replies in the Programming forum as people look there pretty regularly. This is for tech support (problems with the software).

On your first question, I have no idea why your player is climbing walls, sorry. If nobody else answers, reply with more information (detailed as possible as to exactly what happens and if it's consistent.)

On your second question, you can make your sprite rotate as it moves left or right by changing the image_angle. When you add hsp to x, also add hsp to image_angle and see if it looks right. If it rotates too slow or fast multiply it or divide it... example... image_angle+=hsp*0.75;
First of all i posted it in programming forum i got a alert that my post was moved to somewhere else 2nd my player climbing has been fixed
 
Top