By YARN 0 Comments
Whats been made?
A sprite animation engine.
game.cs, FrameAnimation.cs(NEW), SpriteAnimation.cs(NEW), Text.cs(NEW)
"Good artists copy, great artists steal......."
Last night was spent doing alot of research, reading up on techniques, what functions the xna framework has and so on. I also had to get used to typing C# code.
I must've spent alot of time iterating on different methods on how to build the foundation of drawing a simple image on screen. While this doesnt sound hard(in fact, it isnt) you have to keep in mind that you are supposed to be able to manipulate, interact and implement gameplay around this image.
To draw an image(a sprite) in XNA all you have to do is Create a spritebatch object and then use that spritebatch to draw a texture.
This can be done with a few lines of code. but if you want to have a game character moving around a screen and doing stuff you have to code some sort of game character class that has variables such as position, movespeed, hitpoints, experience Etc. This game character class will also have its own texture and will when called draw itself onto the game screen.
Anyway, enough rambling about that.
The first iteration of the game character class was simple. It only had variables such as Texture, size, and position. This was ok for a start but i had some trouble making animations. So i scrapped that, did some research on the internet and found a new way of doing it.
My second attempt on making a character consisted of two classes. A basicsprite class and then a gamecharacter class. Basicsprite had basic methods that would load an image, draw it and position it. Gamecharacter inherited all of the methods and properties of basicsprite and added its own properties such as startposition and character speed. Gamecharacter also had its own methods that would listen to the keyboard for movement.
Anyway i ran into some problems with my second approach and scrapped that aswell.
In the end i settled with my current solution.
A class that set ups the frames in an animation.
A class that handles the position of a sprite on screen, the texture and which animation to play.
And a Actor class that will have gameplay interaction tied to it such as movement. The Actor class provides us with way to manipulate a AnimatedSpriteObject.
So whats next?
Im going to try to get a scrolling background in place.
I guess the pseudocode will be something like this.
int maxBackGroundCrap = 10;
if(currentBackGroundCrap < maxBackGroundCrap ) AddNewBackGroundCrap(random,bottomOfScreen);
if(backGroundCrap.Y < topOfScreen)removeBackgroundCrap();
And thats it for todays update. I will report back in when i´ve gotten some new shit to work in the code.