EricPB
Member
SO, I am a dedicated artist who has decided to try and learn programming myself so i can at least try to make something worthwhile with both skills sets... and so far... i am actually having a lot of fun learning and problem solving!
But there are some issues I cant seem to wrap my head around by trying to look into it myself, and thus I turn to trying and asking the community a direct question hoping to get a direct answer. So here we go...
I followed a shaun spawlding video tutorial to learn the basics, and managed to cobble together my own platformer where I was able to figure out a few things on my own from there (which im proud of being able to do, yay!) but I get stuck at trying to create a more fleshed out wall jump.
I have made the ability to jump up walls, and had i the desire to i could tie it to a limited number of jumps but that function is no longer in the code. The character more or less directly shimmies up the wall where what I want is for them to stick to the wall a bit, slow down and by simple hitting jump again they pop up and out away from the wall. From everything ive read there needs to be a new system made with friction and acceleration which my original coding doesnt have... which leads to my question.
Will I need to make a new system (start over) to allow this kind of movement, or can I work off what I have already in as non-destructive of a way as possible and integrate friction and acceleration- OR is there a way for me to properly achieve this without rewriting anything-?
my code in its entirety is found below, keep in mind some parts ARE commented out because as a noob... i was experimenting.
Create:
Thanks so much for any help you may want to contribute, rly, i couldnt be learning so easily if it wasnt for other peoples patience.
But there are some issues I cant seem to wrap my head around by trying to look into it myself, and thus I turn to trying and asking the community a direct question hoping to get a direct answer. So here we go...
I followed a shaun spawlding video tutorial to learn the basics, and managed to cobble together my own platformer where I was able to figure out a few things on my own from there (which im proud of being able to do, yay!) but I get stuck at trying to create a more fleshed out wall jump.
I have made the ability to jump up walls, and had i the desire to i could tie it to a limited number of jumps but that function is no longer in the code. The character more or less directly shimmies up the wall where what I want is for them to stick to the wall a bit, slow down and by simple hitting jump again they pop up and out away from the wall. From everything ive read there needs to be a new system made with friction and acceleration which my original coding doesnt have... which leads to my question.
Will I need to make a new system (start over) to allow this kind of movement, or can I work off what I have already in as non-destructive of a way as possible and integrate friction and acceleration- OR is there a way for me to properly achieve this without rewriting anything-?
my code in its entirety is found below, keep in mind some parts ARE commented out because as a noob... i was experimenting.
Create:
hsp = 0;
vsp = 0;
grv = 1.8;
walksp = 8;
//fric = 1;
//Can_Jump = true;
Step:/// Player Movement and Collision
//
//Get player input
key_left = keyboard_check (ord("A"));
key_right = keyboard_check (ord("D"));
key_up = keyboard_check (ord("W"));
key_jump = keyboard_check_pressed(vk_space);
key_jrelease = keyboard_check_released(vk_space);
//key_jumphold = keyboard_check_direct(vk_space
//Check Collisions Shortforms
Grounded = (place_meeting(x,y+1,oWall));
InAir = (place_meeting(x,y-1,oWall));
Wall_R = (place_meeting(x+1,y,oWall));
Wall_L = (place_meeting(x-1,y,oWall));
//Additional Player Factors
Clung = Wall_R || Wall_L;
//jumpsp = vsp += Accel * grv;
//jump_number = 2; //How many jumps the player can make
//jump_current = 0; //How many jumps the player has remaining
//Calculate movement
var move = (key_right - key_left);
hsp = move * walksp;
vsp = vsp + grv;
//++Variable jumping
if Grounded && key_jump && Can_Jump
{
vsp = -20;
Can_Jump = false;
}
if key_jrelease and (vsp) < 0
{
vsp = vsp * 0.2;
}
//Double Jumping
//if key_jump && jump_current > 0
//{
// jump_current = jump_number - 1;
// vsp = -20;
//}
//Horizontal Collision for Walls
if (place_meeting(x+hsp,y,oWall))
{
while (!place_meeting(x+sign(hsp),y,oWall))
{
x += sign(hsp);
}
hsp = 0;
Can_Jump = true
}
x += hsp;
//Veritcal Collision for Walls
if (place_meeting(x,y+vsp,oWall))
{
while (!place_meeting(x,y+sign(vsp),oWall))
{
y += sign(vsp);
}
vsp = 0;
Can_Jump = true
}
y += vsp;
//++Wall Clings?
if Clung
{
vsp = vsp * 0.8;
}
//Trying to make it so that holding the key in the direction of the wall youre
//colliding with, you will descend slower
//if Clung && vsp > 0 && !key_right || !key_left
//{
// vsp = vsp * 3 ;
//}
//Animations
if (!Grounded)
{
sprite_index = s_PlayerF
image_speed = 1;
if (sign(vsp) > 0) image_index = 0; else image_index = 1;
}
else
{
image_speed = 1;
if (hsp == 0)
{
sprite_index = s_Player
}
else
{
sprite_index = s_PlayerR
}
}
if (hsp != 0) image_xscale = sign(hsp);
Thanks so much for any help you may want to contribute, rly, i couldnt be learning so easily if it wasnt for other peoples patience.