Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Kope is not working?

New Here ,
Jan 22, 2018 Jan 22, 2018

import flash.events.KeyboardEvent;

import flash.ui.Keyboard;

import flash.display.MovieClip;

import flash.events.Event;

import flash.display.Stage;

linkMc.gotoAndStop("Stand Front Frame");

var rightPressed:Boolean = new Boolean(false)

var leftPressed:Boolean = new Boolean(false)

var upPressed:Boolean = new Boolean(false)

var downPressed:Boolean = new Boolean(false)

var linkSpeed:Number = 10;

var kopeTimer:Number = 0;

var kopeDur:Number = Math.random() * 25;

var kopeFacing:Number = Math.floor(Math.random() * 4);

var kopeSpeed:Number = 3;

//Event Listeners for the Keyboard Events and Enter Frame

stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);

stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);

stage.addEventListener(Event.ENTER_FRAME, gameLoop);

//Key down Event Function

function keyDownHandler(keyEvent:KeyboardEvent):void

{

if(keyEvent.keyCode == Keyboard.D)

{

rightPressed = true;

}

else if(keyEvent.keyCode == Keyboard.A)

{

leftPressed = true;

}

else if(keyEvent.keyCode == Keyboard.W)

{

upPressed = true;

}

else if(keyEvent.keyCode == Keyboard.S)

{

downPressed = true;

}

}

//Key Up Event Function

function keyUpHandler(keyEvent:KeyboardEvent):void

{

if(keyEvent.keyCode == Keyboard.D)

{

rightPressed = false;

linkMc.gotoAndStop("Stand Right Frame");

}

else if(keyEvent.keyCode == Keyboard.A)

{

leftPressed = false;

linkMc.gotoAndStop("Stand Left Frame");

}

else if(keyEvent.keyCode == Keyboard.W)

{

upPressed = false;

linkMc.gotoAndStop("Stand Back Frame");

}

else if(keyEvent.keyCode == Keyboard.S)

{

downPressed =false;

linkMc.gotoAndStop("Stand Front Frame");

}

}

//                                                                                           

//                          Main Loop Enter Frame Function                        

//                                                                                           

function gameLoop(loopEvent:Event):void

{

//Links Movement Controls

if(rightPressed)

{

if (linkMc.x < 800)

{

linkMc.x += linkSpeed;

}

else if(overworldMc.x > -10772.7)

{

overworldMc.x -= linkSpeed;

}

linkMc.gotoAndStop("Walk Right Frame");

}

else if(leftPressed)

{

if (linkMc.x > 200)

{

linkMc.x -= linkSpeed;

}

else if(overworldMc.x < 0)

{

overworldMc.x += linkSpeed;

}

linkMc.gotoAndStop("Walk Left Frame");

}

else if(upPressed)

{

if (linkMc.y > 400)

{

linkMc.y -= linkSpeed;

}

else if(overworldMc.y < 0)

{

overworldMc.y += linkSpeed;

}

linkMc.gotoAndStop("Walk Back Frame");

}

else if(downPressed)

{

if (linkMc.y < 568)

{

linkMc.y += linkSpeed;

}

else if(overworldMc.y > -6260)

{

overworldMc.y -= linkSpeed;

}

linkMc.gotoAndStop("Walk Front Frame");

}

//Kope's Brain

if(kopeTimer < kopeDur)

{

switch(kopeFacing)

{

case 0 :

overworldMc.kopeMc.gotoAndStop("Walk Back Frame")

overworldMc.kopeMc.y -= kopeSpeed;

break;

case 1 :

overworldMc.kopeMc.gotoAndStop("Walk Front Frame")

overworldMc.kopeMc.y += kopeSpeed;

break;

case 2:

overworldMc.kopeMc.gotoAndStop("Walk Left Frame")

overworldMc.kopeMc.x -= kopeSpeed;

break;

case 3:

overworldMc.kopeMc.gotoAndStop("Walk Right Frame")

overworldMc.kopeMc.x += kopeSpeed;

break

}

kopeTimer ++;

}

else

{

kopeDur = Math.random() * 25;

kopeFacing = Math.floor(Math.random() * 4);

kopeTimer = 0;

}

}

242
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 22, 2018 Jan 22, 2018

here is the error

TypeError: Error #1010: A term is undefined and has no properties.

at LANK_fla::MainTimeline/gameLoop()

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jan 25, 2018 Jan 25, 2018
LATEST

I think you would have a better chance at getting a reply if you specified the following:

- What you are trying to do

- The end result of your actions.

Thanks,

Preran

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines