I'm making a game with ActionScript 3, but have been failing at doing a lot of things.
Recently, I moved on to trying to create it by packages, but haven't had much luck with that due to a lot of new things popping in front of me.
I did this based on a tutorial, but it didn't quite explain the things clear enough for me.
Here is how my GameEngine.as looks like and I will explain the issues below it.
Code:
package {
import flash.display.MovieClip;
import flash.display.Stage;
public class GameEngine extends MovieClip {
public function GameEngine() {
var ourChar:character = new character(stage);
stage.addChild(ourChar);
ourChar.x = stage.stageWidth / 2;
ourChar.y = stage.stageHeight / 2;
}
}
}
First of all, I am having issues understanding what the var ourChar:character = new character(stage); means.
I realize it creates a variable named ourChar, but everything after that is unknown to me. Also how do I trace for example, the characters x position with this? As when I try character.x or ourChar.x I just end up having an error.
Code:
/Flashgame/GameEngine.as, Line 15 1119: Access of possibly undefined property x through a reference with static type Class.