-
Notifications
You must be signed in to change notification settings - Fork 6
Programming
Contents
- Use
trace("Game over! You died " + deaths + " time(s)! What a loser!");
- Every class that extends
ABST_Propwill have apublic MovieClipobject calledmc_object. - To translate, change
mc_object.xandmc_object.y.(0,0)is the middle of the screen.-xis left,-yis up. The game is800x600pixels in size. - To affect velocity, change
dxanddy(don't usemc_object). - To rotate, change
mc_object.rotationto a value in degrees from0(right) to360. - To scale, change
mc_object.scaleXandmc_object.scaleY. A value of-1reflects the image. - To affect transparency, change
mc_object.alphato a value in[0, 1]. - To hide without destroying, set
mc_object.visibletofalse.
- When in a
ABST_Obstacle, usecg.player. - When in
ContainerGame, just useplayer. - To get the
Playerposition, usenew Point(player.mc_object.x, player.mc_object.y). If trying to do a collision check, add400toplayer.mc_object.xand300toplayer.mc_object.y. - To check if alive, use
player.alive, apublic Boolean. - To kill, call
player.kill().
- Remember that you must use
mc_objectto get theMovieClipassociated with a class. Don't use just the class itself; it won't work! - For a 'simple and fast' bounding box check between 2
MovieClip, usemovieClipA.hitTestObject(movieClipB). - For a 'precise but slow' pixel-perfect check between a
MovieClipand aPoint, usemovieClipA.hitTestPoint(pointB.x, pointB.y, true). - To make a
Pointwith the location of aMovieClipsuch asmc_object, usenew Point(mc_object.x, mc_object.y).
- To access the current time scale, use
TimeScale.s_scale, apublic static Numberthat is normally1. Multiply it with stuff, such asdX.
- A
MovieClipis essentially the graphic that's being displayed. It has built-in features such asx,y, androtation.
- Try importing the thing it can't find. Go to the top immediately after the first
{and typeimportand then the name of the thing you're trying to use. FlashDevelop should auto-complete it.
- You need to use
mc_objectto get these variables. Many are listed below. -
x,y,rotation,scaleX,scaleY,alpha
An abstract class containing useful functions for all game objects.
It is updated every frame (30/sec) by calling step(), and the object is removed if completed is set to true. The actual MovieClip graphic object associated with this ABST_Prop is mc_object.
The class that handles the player, including listening for W A S D Shift keyboard presses.
An abstract class implementing the core functionalities for an obstacle.
It is given a JSON object in its constructor (_params) that it will use with setParam() to set itself up. It is managed by ObstacleManager and queued up to be spawned in ObstacleTimeline.
Updates all of the game's ABST_Obstacle objects. Uses ObstacleTimeline to figure out what obstacles to spawn, and when to spawn them.
For some reason, also checks if the Player has collided with a deadly obstacle. Why is that? We should move that to ABST_Obstacle...
Keeps track of the obstacles to be spawned in a level.
Keeps track of high-level game state (such as menu or game), and provides the primary step firer based on Event.ENTER_FRAME.
Manages the higher-level game elements, such as Player and ObstacleManager.