Here is my AnimatedSprite class:
http://mage360.pastebin.com/f2c03daf1
And here is a video showing it off, on an amazing video hosting website that lets you record your screen:
http://www.screentoaster.com/watch/stWE5RRUdIR19ZRFhYWFJdVlZV/sprite_animation_and_movement
Wednesday, February 17, 2010
Thursday, February 11, 2010
Game state management
I've created a class to manage the current game state. It's a very simple but flexible way to manage the current state of the game. I can just derive classes from the GameState class for anything from the main menu to the game in progress, and easily switch between states.
Here is a link to the GameState class source:
Monday, February 1, 2010
SpriteList v1
I've created a simple class to handle variable amounts of sprites from a single simple interface. This is called SpriteList.
Link to the SpriteList class:
http://mage360.pastebin.com/f3aaf313
Link to the SpriteList class:
http://mage360.pastebin.com/f3aaf313
Sprite class v3
The sprite class now has a scaling effect. Testing all effects together I have the sprite fading from 50 alpha to 255 alpha over 2 seconds, at the same time it is rotating counterclockwise by 180 degrees over 2 seconds. While both of those are happening it is also scaling to 3x the original size over 2 seconds.
This is the code being used to test the effects together:
test = new Sprite(Content.Load("Sprites\\Statues"));
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);
test.beginScalingEffect(3.0f, 2000.0f);
Here is a link to the sprite class:
http://mage360.pastebin.com/f427b2e0b
This is the code being used to test the effects together:
test = new Sprite(Content.Load
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);
test.beginScalingEffect(3.0f, 2000.0f);
Here is a link to the sprite class:
http://mage360.pastebin.com/f427b2e0b
Sprite class v2
The sprite class now has a rotation effect. Testing them together I have the sprite fading from 50 alpha to 255 alpha over 2 seconds, at the same time it is rotating counterclockwise by 180 degrees over 2 seconds.
This is the code being used to test the 2 effects together:
test = new Sprite(Content.Load("Sprites\\Statues"));
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);
Here is a link to the sprite class:
http://pastebin.com/f68be73c6
This is the code being used to test the 2 effects together:
test = new Sprite(Content.Load
test.position = new Vector2(50.0f, 50.0f);
test.setTransparency(50);
test.beginFadeEffect(255.0f, 2000.0f);
test.beginRotationEffect(MathHelper.ToRadians(-180.0f), 2000.0f);
Here is a link to the sprite class:
http://pastebin.com/f68be73c6
Sprite class v1
Here is a video of my sprite class for doing 2D graphics, demonstrating the fade effect.
The sprite class source:
http://pastebin.com/f6fd08893
The sprite class source:
http://pastebin.com/f6fd08893
Subscribe to:
Posts (Atom)