-
Notifications
You must be signed in to change notification settings - Fork 7
Programming
Contents
- Use
trace("Game over! You died " + deaths + " time(s)! What a loser!");
- Every class that extends
ABST_Prop
will have apublic MovieClip
object calledmc_object
. - To translate, change
mc_object.x
andmc_object.y
.(0,0)
is the middle of the screen.-x
is left,-y
is up. The game is800x600
pixels in size. - To affect velocity, change
dx
anddy
(don't usemc_object
). - To rotate, change
mc_object.rotation
to a value in degrees from0
(right) to360
. - To scale, change
mc_object.scaleX
andmc_object.scaleY
. A value of-1
reflects the image. - To affect transparency, change
mc_object.alpha
to a value in[0, 1]
. - To hide without destroying, set
mc_object.visible
tofalse
.
- When in a
ABST_Obstacle
, usecg.player
. - When in
ContainerGame
, just useplayer
. - To get the
Player
position, usenew Point(player.mc_object.x, player.mc_object.y)
. If trying to do a collision check, add400
toplayer.mc_object.x
and300
toplayer.mc_object.y
. - To check if alive, use
player.alive
, apublic Boolean
. - To kill, call
player.kill()
.
- Remember that you must use
mc_object
to get theMovieClip
associated 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
MovieClip
and aPoint
, usemovieClipA.hitTestPoint(pointB.x, pointB.y, true)
. - To make a
Point
with the location of aMovieClip
such asmc_object
, usenew Point(mc_object.x, mc_object.y)
.
- To access the current time scale, use
TimeScale.s_scale
, apublic static Number
that is normally1
. Multiply it with stuff, such asdX
.
- A
MovieClip
is 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 typeimport
and then the name of the thing you're trying to use. FlashDevelop should auto-complete it.
- You need to use
mc_object
to 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
.