jump to navigation

Animating a Sprite Sheet April 9, 2009

Posted by legendsoftheblackmoon in games.
add a comment

O_o .. interesting part now, gotta animate the stilllife all around. Its really quite simple, what i did that is:

Assuming all the animations are laid out neatly ina  sprite sheet, we have a table.

With rows and columns, so any algo would read thus:

1.  Get Row of Anim

2. Get Column of Anim

3. Get Anim : Height & Width

4. OnAnimStart() – Load source image from sprite sheet as a rectangle with

Height = Anim Height

Width = Anim Width

Position = (X,Y)   :  (0,0) Initially:

5. For subsequent frames,

increment Position.X by Sprite.Width times

And here’s the code

//Animation variables
protected int currFrame = 0;
protected int currRow = 0;
protected int currFrameSpeed = 0;
protected int animeThreshold = 8;

public Rectangle rectSource;
public Rectangle rectDestination;

/**Animate Sprite**/
if(currRow == 0)
{
if(this.currFrame < 6)
{
this.currFrameSpeed += 1;
if (this.currFrameSpeed == animeThreshold)
{
this.currFrameSpeed = 0;
this.currFrame += 1;
}
}
else
{
this.currFrameSpeed = 0;
this.currFrame = 0;
}
}
else
{
this.currRow = 0;
this.currFrameSpeed = 0;
this.currFrame = 0;
}

rectSource = new Rectangle(currFrame * this.spriteWidth, currRow * this.spriteHeight, this.spriteWidth, this.spriteHeight);
rectDestination = new Rectangle((
int)this.position.X, (int)this.position.Y, this.spriteWidth, this.spriteHeight);

Additionally i found the need to control the speed of the animation, this was accomplished by adding a control variable

currFrameSpeed

i kept on incrementing it till it reached a predecided threshold.

:D Simple ha, of course this is just a simple and ok,ok way of doing it

Characteristically speaking February 1, 2009

Posted by legendsoftheblackmoon in games.
add a comment

Woah, its been months since my last post, but hey, LotBM is moving ahead with full steam.

Finally got down to the gruelling task of coding the actual game, and.. well waddayaknow – time to select characters

Dunno, some where between new Character(), i was like, this guy (dont ask me why not gal ) shud be a mage, spellcaster, now, ahaa… ,

“Now introducing .. from the Hogwarts Adult School of  Magic, with a degree in Defence Against the Dark Arts, i a proud to announce – The Speller of Doom” 

**Drumroll**

Now, this fella’s gonna be the yardstick for the rest of em, with common features like:

characterName, characterStatus, etc.. and methods like move(), fight(), interact().

 

Soon, new character classes to come. Keep watching this space

Modelling October 8, 2008

Posted by legendsoftheblackmoon in games.
Tags: , , ,
add a comment

A pre requisite for any software project is, design of the project, more so in a game, when state transitions and entity moniring etc. are to eb kept tarck of. And before coding, one will need to know what to implement, its mor eof, translating the story line into concrete “real world” entities, that is, craetign classes and abstracting the design.

Activity Diagram

Activity Diagram

Data Flow Diagram

Data Flow Diagram

State Diagram

State Diagram

Key to succesfully coding, is obviosuly design. with a diagramatical rep of the system, its easy to visualize, implement classess, and of course makes for easy understanding of the project by the non technical team.

Project Report for 11th Oct, 2008

Presenting : Legends of the black moon August 17, 2008

Posted by legendsoftheblackmoon in games.
Tags: ,
add a comment

So , 4 days to go before our first real, report is due to the ommitee at Uni, we have to show them what we’ve “researched” and seen in the past month or so. Well, i decided to make a presentation for the same, pretty neat, photoshopped some fancy slide background images, and a cool watermark, and a not-so-impressive opening screen, bit what the heck, oh wait, 10 marks are at stake over hear.

Check out the ppt here ..presentation_1-22nd-august-2008

A game witha VIEW .. August 12, 2008

Posted by legendsoftheblackmoon in games.
Tags: , , , , , ,
add a comment

Legends of teh Black Moon, is moving into design phase .. but, wait ..

.. the most important aspect currently in discussion is, what kind of view, dats possibly the USP besides the theme , and game story and, well ok, .. i shortlisted 3

  • Isometric
  • Side Scrolling
  • Top View

Isometric, is well, you visually represent a 3D dimensional object, in 2D. You display the game stuff on the X,Y,Z axes. Makes for lotsa room on the screen, and lotsa more stuff can be done.

Side scrolling, every1′s gotta have played Mario, its a typical side scrolling 2d game, simple to implement, collision detection, no worries, etc …

Finally, top view, GTA II was top view, u see very little of the character you control, and not a very pretty sight, although, from my point of view, its rather simple.

Gotta decide, within a few days or so, what kind of view we gonna be implementing, in LotBM …

What factors come in to play would be:

  1. Framework support
  2. Coding feasibility
  3. Calculations expected
  4. posiblility of sprite positioning
  5. etc ..

Let’s see what i come up with .. keep this post updated till then

Rock Rain – The pirated Demo July 11, 2008

Posted by legendsoftheblackmoon in games, tips, xna.
Tags: , , , , , , ,
add a comment

Soo .. after a week of toil .. i have a small game, if u may call it that. Its a simple enough concept actually, the player controls a spaceship ( more like a UFO ), and the objective is to navigate through a meteor shower. The speed of the meteors approaching is controllable, programmatically :p Calling it pirated, because i kinda didnt design it myself, just got a few tut’s together, and played it blind with a load of personal mods.
Made a game class :
Game1.cs – Main class that .. acts as the engine, controlling the sprite drawing, game logic and handling the GameComponent‘s.
Ship.cs – The class that describes the player controlled Ship, its size, sprite location, speed and movement, also, its gotta check for movement of the ship, so that it stays within the Window bounds.
Meteor.cs – The meteor class, similar to ship to CS, exception is that the meteor’s created are automated, fixed stuff, placement, initially is random, with the rocks accelerating towards the bottom.

Game Logic : The sprites are loaded, meteor and ship share the same Texture2D, that is, the meteor and spaceship are in one image, just the particular region is selected by the respective classes.
The game engine checks for collisions’, and creates the GameComponents, namely the meteors, and the player ship. The scoreboard was not properly implemented, and i/ or i got bored. Lolzz..

Download the Game Here ( with Source Code )

Adding media to an XNA Game .. July 4, 2008

Posted by legendsoftheblackmoon in games.
Tags: , , , , , , ,
add a comment

Okies.. so this blog is fast turning into a crash course in game making … i dont really mind… I tried adding sprites to my skeleton project ..

The best way to do it was :

In the Solution Explorer pane, Right click the “Content” folder, and Add > Existing Item >

This pops up the Add Existing Item file browser window, with the file type filter set to “Content Pipeline Files”. That’s it, now i just select my image and i can modify its properties by pressing F4..

———————————

Here’s a sample video with basic collision detection ..

The XNAtor July 3, 2008

Posted by legendsoftheblackmoon in games.
add a comment

Now when i decided to make LotBM ( Legends of the Black Moon), i had these nagging doubts at the back of my medula oblongata that making a game would be a huge deal – after all , all i  know abt em is the genre’s.. hehe well a lot but still, not even a modicum of experience in coding a game. All i had was, a half baked project (.. for that matter, idea also ) of a browser based MMORPG “The Gaffer”, [ A FIFA meets Fantasy Soccer messup ] in crude JSP.

So the obvious points of interest were which language, platform etc … Windows was a natural and logical choice. But when choosing a language i was torn between quite a few…. knew it cud be done wid C++, OpenGL and Dx9, seen another  friend do it in Java, with a  lil J2ME experience myself i felt i cud go mobile. But then i yearned, had, for the better part of my virtual life to one day be able to make / play my own PC game. So neways, i decided on basing my game on the XNA Framework, which is a .Net compact framework derivative or something. It even came with its own IDE, which was actually a Visual Studio (2005) plug in.

SO here i am…

Platform : Windows XP, Vista

Language : XNA, C#

Graphics / Sprites : Adobe Photoshop (:p doesnt everyone)

Dev Suite : Visual Studio 2005 ( SP 1 )

I usually use SciTe for text editing .. and got some books on XNA and C# programming

  1. Beginning XNA 2.0 Game Programming From Novice to Professional
  2. Sams Teach Yourself Visual C# 2008 in 24 Hours
  3. Beginning CSharp Game Programming
  4. Google .. Meh

Apparently XNA offers a basic template for developing a game, and u can even make XBOX compatible games .. pretty cool eh. So i fire up the IDE, launch a new Windows Game and i see a skeleton of my very first XNA game.. cool lets code..

While coding in XNA, according soem tutorials i read ..

Initialize graphics, input and sound
Load resources
Start game loop. In every step:
Gather user input
Perform needed calculations (AI, movements, collision detection, etc.)
Test for game ending criteria – if met, stop looping
Draw (render) screen, generate sounds and game controller feedback
Finalize graphics, input, and sound
Free resources

Are the basic.. is the basic Algo that is to be followed …

I see a program.cs and game1.cs ..

Game1.cs Skeleton

Game1.cs Skeleton

XNA Game class overridable methods:

Filename : Game1.cs
Game1()General initialization (already written for us)
Initialize() Include nongraphics initialization here
LoadContent() Include graphics initialization here
Run()Start game loop. In every step:
Update()Include code here to read and process user input, do calculations for AI, movements, and collisions, and test for game ending
Draw() Include the drawing (renderization) code here
UnloadContent() Free graphics resources

Filename : Program.cs

static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
static void Main(string[] args)
{
using (Game1 game = new Game1())
{
game.Run();
}
}
}

The birth of a legend .. June 30, 2008

Posted by legendsoftheblackmoon in games.
Tags: , , , , , , , ,
1 comment so far

Over a million years ago, the ancients that walked the Earth, witnessed what history books claim to be the first black moon – the first black moon and which would be their last one. Because on that fateful day, when their curiosities led them to stray deep into the dark lands of Wnaytee-Eye, the horrors that unfolded before their eye, ravaged them so bad they chose death over a chance to stay alive and slave for the denizens of the evil that lay there.Summoned forth from a parallel dimension – came forth beasts and specter’s of doom, supposedly to pay obeisance and do the  bidding of their summoners, the unknown EnSventer’s..

add_more_crap

“Legends of the Black Moon“, will be a 2D RPG – born primarily out of the need to satisfy my lifelong desire to code a game of my own, but also as a necessity to complete my graduation, a project being the final piece of the jigsaw that laid out my 7 year itch. The etymology of the name, so to speak, arose out a discussion i had with my close friend Poonam, who dropped a note about a song, “Who painted the moon black”, by Hayley Westenra, i ‘jimped’ at the very though, added a lil twist and finally ran it past her, to be met with prompt approval. So here i am, on the doorstep of my foray into the world of game programming …

A multitude of conferences on yahoo messenger later, with a couple of friends ( Basil & Yorrick) , i settled on coding in the relatively new Microsoft XNA Framework,  using the purely object oriented C# language.

add_more_acknowledge

Follow

Get every new post delivered to your Inbox.