Skip to content
Yin Xiaoguang edited this page Mar 30, 2023 · 10 revisions

Useful Classes

WDC.Game

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

You need to impelement the following methods once you create your own movement controller class

Method Name Parameters Description
GetNext None Get Next avaliable position
GextNextX None Get Next X Position
GextNextY None Get Next Y Position

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

WDC.UI

This class will render a ordered option widget without background

This class will render a static text widget in the canvas

This class will render a clickable image button

Clone this wiki locally