Game Development Reference
In-Depth Information
{
return true;
}
return false;
}
Run the program and move the mouse over the rectangle. Like the circle ex-
ample, it will turn red demonstrating that the intersection code works.
Tweens
A tween is a method of changing one value to another over time. This can be
used for animating, changing position, color, scale, or any other value you can
think of. Tweening is probably most well known for its use in Adobe Flash, which
comes with many tween functions already built in.
An Overview of Tweening
It's probably easiest to show an example to give a rough idea how it works and
then dive into the details. This state can be used in your existing code base, but if
you want to create a new project then you'll need to remember to add references
to Tao.DevIL and add the Sprite , Texture , and TextureManager classes.
class TweenTestState: IGameObject
{
Tween _tween = new Tween(0, 256, 5);
Sprite _sprite = new Sprite();
public SpriteTweenState(TextureManager textureManager)
{
_sprite.Texture = textureManager.Get("face");
_sprite.SetHeight(0);
_sprite.SetWidth(0);
}
public void Render()
{
// Rendering code goes here.
}
public void Update(double elapsedTime)
 
 
Search WWH ::




Custom Search