-
Notifications
You must be signed in to change notification settings - Fork 0
Guide
DoDoCat edited this page Jun 9, 2020
·
11 revisions
The Sprite is the main actor in the game, if you want to create a sprite, use the following code:
Sprite s = new Sprite( ... )
There are 5 parameters for the sprite constructor method (the sixth parameter is useless)
parameter name | type | description |
---|---|---|
image |
Image | the bitmap image of the sprite |
position |
PointF | initial position |
collideCheckTolerance |
float | will control the collide check |
scale |
float | sprite scale |
alignment |
AlignMethod | sprite alignment method |
The SpriteMovement is a virtual class can control the sprite movement in the canvas
You can't use this class directly, you need to inherit this class and impelment your own movement class
The SpriteAxisMovement class inherit from the SpriteMovement class which can control sprite move along a spific axis (X or Y)
SpriteAxisMovement movementController = new SpriteAxisMovement( ... )
There are 4 parameters for this constructor method
parameter name | type | description |
---|---|---|
type |
int | 0 - X Axis, 1 - Y Axis |
direction |
int | 0 - Positive Movement, 1 - Negative Movement |
startPos |
PointF | Initial Start Position |
speed |
float | Movement speed |
Once you create this object, you can use Sprite.SetSteering
to assign this movement controller to the sprite
Then you can use Sprite.MoveTo
to move the sprite