Ok, I know this is probably basic programming 101, but as previously stated i'm new to Game Maker, let alone programming a game. But I think i'm getting things rolling, just having a problem.
//Weapon Menu Controls
if (keyboard_check(ord('A')))
{
if (weaponDelay > 0)
{
weaponDelay -= 1;
}
else
{
weapon -=1;
weaponDelay = weaponDelayMax;
}
}
else
{
weaponDelay = 0;
}
if (keyboard_check(ord('S')))
{
if (weaponDelay > 0)
{
weaponDelay -= 1;
}
else
{
weapon +=1;
weaponDelay = weaponDelayMax;
}
}
else
{
weaponDelay = 0;
}
In this code, the variable "weapon" refers numerically to the user's currently selected weapon. For example 1=Pistol, 2=Shotgun, 3=Machine Gun, etc...
I want the keys A and S to flip between weapons. The problem is since this is inside of the Step event, pressing A or S causes rapid fire flipping of the weapons.
So i decided to alleviate the issue by adding a small "delay" between switching weapons whenever the button is held down. However, with the code as written above, the rapid fire switching still occurs.
I finally figured out that this is because "weaponDelay = 0" is declared for both keys, effectively making sure that weaponDelay will always = 0. So I tried removing else weaponDelay = 0 from one key, but the result was that whatever key didn't have code still rapid fired when pressed, while the other key worked properly. I can't figure out how to get the keys to play nice.

P.S. I'm not sure if i'm bending any forum rules by consistantly asking questions within this topic, or if I should be making my own topic. If I am breaking a rule or generally annoying people, I apologize.
P.S. Part 2: If anyone would be willing to answer "every now and again" questions about Game Maker via AIM so that I don't have to clutter this forum, PM me please! Thanks.