Jump to content
  • Advertisement
Sign in to follow this  
SSJCORY

Mechanics behind a 2 d game.

This topic is 4725 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone explain the mechanics behind games. Like how each thing should be taken care of? It would be a lot of help to me. I'm sure theres a link to it around here somewhere but i cant find it. Can someone direct me. THanks, Cory

Share this post


Link to post
Share on other sites
Advertisement
I would recommend checking out the beginners forum faqs or googling what you are looking for. Maybe you could get a better response if you were a little more specific as to what you are interested in. Are you trying to figure out game physics, AI, something else maybe? Your question is just a little too broad to be answered well.

Share this post


Link to post
Share on other sites
Hmm... a 2d game. Well, I dont claim to be an expert, or even particularly experienced in making games, but here goes the basics..

Chances are it will be tile based in some way. If it is a platform game, you will probably have a tiled background. If it is a top down game (think rpg) you will probably have tiled ground. There's probably a better way, but I make an array of integers, each corresponding to a different tile. Load the images, and display them based on the numbers in the array. Shouldn't be too hard. Do that at the beginning of each frame (each time through the main loop)

As far as a character, you need some way of getting what keys the person pressed, so make some sort of 'processkeyboard' function, that handles all of the keyboard pressing. I have a generic class that I change based on what controls I need. I call it ControlHolder, which is basically a list of bool values of what keys are down. Then, when I need to check for what keys are down to move, shoot, swing a sword, whatever, its all right there for me.

Of course, you will then have to display the character. You'll need to have an animation system of some sort, usually. I like space games, because you don't have to mess with animation. (spaceships dont have moving parts :) ) I've actually never done 2d animation for a game, but I guess you could have a list of images, and a number that increments each frame, displaying the image that corresponds to it. Thats the basic idea behind it, pretty simple. Hope it gives you a start.

~Adam~

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!