The Arena Object
The following section is dedicated exclusively to the arena. This is the area inside the white box
that the player is allowed to move within. Projectiles can spawn and move relative to the arena,
and the arena can be resized and moved.
The Arena object
You can use this object to obtain information about the arena, resize it or move it.
Don't forget that the Arena's position is reset at the end of the wave!
- Arena.width (readonly) - the width of the arena in pixels, after resizing. Since the reference for
the player and bullets is the arena's center, you can get the left/right side of the arena with
-Arena.width/2 and Arena.width/2 respectively.
- Arena.height (readonly) - the height of the arena in pixels, after resizing. Like with width, you
can get the bottom/top with -Arena.height/2 and Arena.height/2 respectively.
- Arena.x (readonly) - the x position of the center of the Arena,
after resizing.
- Arena.y (readonly) - the position of the bottom of the Arena,
after resizing. To get that of the center, just do Arena.y + Arena.height/2.
NOTE: Arena.y is the position of the bottom of the outside (white part) of the Arena. It will be 5 pixels (the
arena's width) less than Arena.currenty.
- Arena.currentwidth (readonly) - the current width of the arena in pixels. Differs from
width in that it will accurately reflect the arena size in the middle of resizing, too.
- Arena.currentheight (readonly) - the current height of the arena in pixels. Differs from
height in that it will accurately reflect the arena size in the middle of resizing, too.
- Arena.currentx (readonly) - the current x of the arena in pixels. Differs
from x in that it will accurately reflect the arena position in the middle of moving, too.
- Arena.currenty (readonly) - the current y of the arena in pixels. Differs
from y in that it will accurately reflect the arena position in the middle of moving, too.
NOTE: Arena.currenty is the position of the bottom of the inside (black part) of the Arena. It will be 5 pixels (the
arena's width) greater than Arena.y.
- , , , = 1 Arena.innerColor
- Set RGBA color (0-1) of Arena's inner sprite.
- < , , , = 255 Arena.innerColor32
- Set RGBA color (0-255) of Arena's inner sprite.
- , , , = 1 Arena.outerColor
- Set RGBA color (0-1) of Arena's outer sprite.
- , , , = 255 Arena.outerColor32
- Set RGBA color (0-255) of Arena's outer sprite.
- Arena.isResizing (readonly) - Tells you if the Arena is currently being resized.
: There's an equivalent of this in
0.2.1a - just use
Arena.currentwidth ~= Arena.width or Arena.currentheight ~= Arena.height.
- Arena.isMoving (readonly) - Tells you if the Arena is currently being moved.
- Arena.isModifying (readonly) - Returns true if the Arena is being moved or
resized, false otherwise.
- Arena.Resize( width, height) - Resizes the arena to the new size. Currently, monsters stay on top of
the arena. This was going to be changed around the animation update.
But, in CYF, you can use
BindToArena to control that!
- Arena.ResizeImmediate( width, height) - Resizes the arena instantly, without the animation.
- Arena.Move( x, y,
movePlayer = true, immediate = false) - Moves the Arena
based on its current position. Set movePlayer to true if you want the Player to move with the Arena and set
immediate to true if you want to move the Arena immediately.
- Arena.MoveTo( x, y,
movePlayer = true, immediate = false) - Moves the Arena
based on the bottom-left corner of the window. Set movePlayer to true if you want the Player to move with the
Arena and set immediate to true if you want to move the Arena immediately.
- Arena.MoveAndResize( x, y,
width, height, movePlayer = true,
immediate = false)
- Moves the Arena based on its current position and resizes it at the same time.
Set movePlayer to true if you want the Player to move with the Arena and set
immediate to true if you want to move the Arena immediately.
- Arena.MoveToAndResize( x, y,
width, height, movePlayer = true,
immediate = false)
- Move the Arena based on the bottom-left corner of the window and resizes it at the same time. Set
movePlayer to true if you want the Player to move with the Arena and set immediate to
true if you want to move the Arena immediately.
- Arena.Hide( showWhenWaveEnds = true)
- Makes the Arena invisible, but it will stay active. If showWhenWaveEnds is set to true, the Arena will
be shown again after the end of the wave. Setting it to false will keep it hidden until it's manually shown again.
- Arena.Show() - Makes the Arena visible after using
Arena.Hide.
This is called automatically whenever a wave ends if the showWhenWaveEnds argument of
Arena.Hide() is set to true upon its last use.