I am new to Adobe Flash Action Script 3.0 but learning.
Geweer = the guy you are and kogel = bullet
I am having this code:
var geweer; .
stage.addEventListener(KeyboardEvent.KEY_DOWN,beweeg);
function beweeg(event:KeyboardEvent)
{
switch(event.keyCode)
{
case 38:
geweer.y = geweer.y -10;
kogel.y = kogel.y -10;
break;
case 40:
geweer.y = geweer.y +10;
kogel.y = kogel.y +10;
break;
case 32:
kogel.x = kogel.x +20;
break;
}
}
As you see. Case 32. When launched. The bullet will move from position only once(unless I press it multiple times). How can i make it to repeat(Without pressing multiple times)? And do it multiple times, to shoot multiple bullets.
You will have to write a game loop which handles all your logic at a regular time interval. A basic way to do this in actionscript is by subscribing to the ENTER_FRAME event.
Since your programming skills seem limited I suggest you first try to follow several tutorials on the subject you are attempting to program before asking such specific questions here.
A quick search seems to be able to help you. Check out ‘PART 2 – Advanced detection’ on this page.