GAMIE64
GAMIE64

Reputation: 5

AS3 1084: Syntax error: expecting rightparen before colon

i'm trying to make an AS3 shooting game, which is player right to left. I want to make it so that, when i shoot (spawnKogel) shootAllow becomes false, and then initiates kogelCheck, which checks if the bullet (Kogel) is < -10. If that's true, shootAllow becomes True, and i can shoot again.

But i'm getting the error in the title, at the end of the spawnKogel, when I try to initialize kogelCheck. Here's my code:

package 
{
import flash.display.MovieClip;
import flash.events.KeyboardEvent;
import flash.events.Event;
import flash.ui.Keyboard;
import flash.ui.Mouse;
import flash.events.MouseEvent;
import flash.display.Stage;
import flash.media.Sound;
import flash.utils.Timer;
import flash.events.TimerEvent;

public class amateurodius extends MovieClip
{
    public var schip:ruimteschip = new ruimteschip();
    public var Kogel = new Bullet();
    var sound = new lazor();
    var BGM = new Muziek();
    var backdrop = new background();
    var shootAllow:Boolean = true;

    public function amateurodius()
    {
        addEventListener(Event.ADDED_TO_STAGE, initialize);
        addEventListener(Event.ENTER_FRAME, vijandmaken);
        stage.addEventListener(KeyboardEvent.KEY_DOWN, spawnKogel);
        addEventListener(Event.ENTER_FRAME, kogelCheck);
        Mouse.hide();
    }

    function initialize(e:Event)
    {
        addChild(backdrop);
        addChild(schip);
        BGM.play();
    }

    function spawnKogel(e:KeyboardEvent):void
    {
        if (shootAllow == true)
        {
            if (e.keyCode == Keyboard.SPACE)
            {
                addChild(Kogel);
                Kogel.x = schip.x;
                Kogel.y = schip.y;
                sound.play();
                shootAllow = false;
                kogelCheck (e:Event);
            }
        }
    }

    function kogelCheck (e:Event)
    {
        if (Kogel.x < -30)
        {
        shootAllow == true;
        }
        else
        {
        shootAllow == false;
        }
    }

Upvotes: 0

Views: 3618

Answers (1)

net.uk.sweet
net.uk.sweet

Reputation: 12431

Remove the type from event when you call kogelCheck:

// Just passing on the event, doesn't need type declaration
kogelCheck (e);

Upvotes: 1

Related Questions