Method | Description | |
---|---|---|
ChaseAndEvadeGame ( ) : System | ||
ChaseAndEvadeGame ( Android.App.Activity activity ) : System |
Method | Description | |
---|---|---|
Draw ( |
This is called when the game should draw itself. Nothing too fancy in here, we'll just call Begin on the SpriteBatch, and then draw the tank, cat, and mouse, and some overlay text. Once we're finished drawing, we'll call SpriteBatch.End.
|
|
Initialize ( ) : void |
Overridden from the base Game.Initialize. Once the GraphicsDevice is setup, we'll use the viewport to initialize some values.
|
|
LoadContent ( ) : void |
Load your graphics content.
|
|
Update ( |
Allows the game to run logic.
|
Method | Description | |
---|---|---|
ClampToViewport ( Vector2 vector ) : Vector2 |
This function takes a Vector2 as input, and returns that vector "clamped" to the current graphics viewport. We use this function to make sure that no one can go off of the screen.
|
|
HandleInput ( ) : void |
Handles input for quitting the game.
|
|
TurnToFace ( Vector2 position, Vector2 faceThis, float currentAngle, float turnSpeed ) : float |
Calculates the angle that an object should face, given its position, its target's position, its current angle, and its maximum turning speed.
|
|
UpdateMouse ( ) : void |
This function contains the code that controls the mouse. It decides what the mouse should do based on the position of the cat: if the cat is too close, it will attempt to flee. Otherwise, it will idly wander around the screen.
|
|
UpdateTank ( ) : void |
UpdateTank runs the AI code that will update the tank's orientation and position. It is very similar to UpdateMouse, but is slightly more complicated: where mouse only has two states, idle and active, the Tank has three.
|
|
Wander ( Vector2 position, Vector2 &wanderDirection, float &orientation, float turnSpeed ) : void |
Wander contains functionality that is shared between both the mouse and the tank, and does just what its name implies: makes them wander around the screen. The specifics of the function are described in more detail in the accompanying doc.
|
|
WrapAngle ( float radians ) : float |
Returns the angle expressed in radians between -Pi and Pi. the angle to wrap, in radians.
|
public ChaseAndEvadeGame ( Android.App.Activity activity ) : System | ||
activity | Android.App.Activity | |
return | System |
protected Draw ( |
||
gameTime | ||
return | void |
protected Update ( |
||
gameTime | ||
return | void |