I'm trying to make this game in Adobe Flash CS5.5, but I'm running into problems when I try to add a shooting feature. Can anyone help? The file just freezes when I press space, and then a little later starts behaving normally, except there's never any laser/bullet thing. I don't get any output or compiler errors. Also, is there a version of that kongregate.com/labs tutorial for AS3? Thanks in advance!
import flash.events.KeyboardEvent;
import flash.ui.Keyboard;
stage.addEventListener(KeyboardEvent.KEY_DOWN, fire);
function fire(evt:KeyboardEvent):void
{
if (evt.keyCode == Keyboard.SPACE)
{
var laser:bullet = new bullet;
stage.addChild(laser);
laser.x = player.x + player.width / 2;
laser.y = player.y;
while (laser.y > 0)
{
laser.y += 5;
}
stage.removeChild(laser);
}
}Offline
Wow. 100+ views and not a reply.
Last edited by maxskywalker (2012-01-12 14:14:51)
Offline
you need to put it in a package and all that stuff
wow a lot of flash topics recently
Offline
GameHutSoftware wrote:
you need to put it in a package and all that stuff
wow a lot of flash topics recently
Source code please?
Offline
well
you have to start it with this:
package
{all code has to be in a package
Offline