• 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!

Windows shooting

F

FluffysGaming69

Guest
im making a platformer game and i need to add shooting can anyone help me with a code.
 
F

FluffysGaming69

Guest
this is the code i have now for movement and gravity



//get player input
key_left = keyboard_check(vk_left);
key_right = keyboard_check(vk_right);
key_jump = keyboard_check(vk_up);
key_shoot = keyboard_check_pressed(vk_space);

//calculate movement
var move = key_right - key_left;

hsp = move * walksp;

vsp = vsp + grv

if (place_meeting(x,y+1,obj_blockbasic)) && (key_jump)
{
vsp = -7
}


// horizontal collision
if (place_meeting(x+hsp,y,obj_blockbasic))
{
while (!place_meeting(x+sign(hsp),y,obj_blockbasic))
{
x = x + sign(hsp);
}
hsp = 0;
}


x = x + hsp;

// vertical collision
if (place_meeting(x,y+vsp,obj_blockbasic))
{
while (!place_meeting(x,y+sign(vsp),obj_blockbasic))
{
y = y + sign(vsp);
}
vsp = 0;
}


y = y + vsp;
 

Bingdom

Googledom
3 results I got after searching "how to make a player shoot game maker"
You know, It would be faster to search for the problem rather than making a topic ;)
 
F

FluffysGaming69

Guest
the thing is is that i did. i couldnt find one about gms2 and one that didnt have dnd
 
G

Guest

Guest
GMS1.4 tutorials will mostly apply to GMS2 unless you're doing something with tiles. Those tutorials will help you out.
 
Top