Hello forum
I am trying to make a top down engine but I want the "E" key to be use different times. I am not sure how to get it to be like most modern FPS games on the PC were you go up to a weapon and hold "E" to switch weapon that was on the ground. right now in the engine I have it so you can switch weapons but the player has them already. please help, with the help right it out in code then tell were I can change code to fit object.
Weapon pick up by holding key
Started by anerror, Mar 17 2012 04:59 AM
3 replies to this topic
#1
Posted 17 March 2012 - 04:59 AM
#2
Posted 17 March 2012 - 07:03 AM
make a variable that increases when you hold E. when it reaches a value, pick up the weapon. when released, reset to 0.
#3
Posted 17 March 2012 - 08:28 AM
Meh it's a complicated situation depending on your current engine. As a starting point, instance_place() is a nice function to know how to deal with.
#4
Posted 19 March 2012 - 02:24 AM
okay so this is what you want to do in the obj_player:
//collision with obj_sword
if keyboard_check_pressed(ord("E")){
instance_change(obj_player_sword,1)//or whatever...
instance_create(obj_player.x+32,obj_player.y+16,obj_sword)
}
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











