Helpful Information
 
 
Category: Game Development
Game level Objects

If you was to create a game that requires alot of objects specially on a certain level.. how would you create the objects? Would you define them in a class ( i.e level_ 1 = "objects1, objects2... etc ) or would you randomly select them? See the thing is that im coding an arkanoid clone.. a very basic one for now, untill I can advance knowledge wise in creating games.

I think it'd depend on the game, if the game always has to look the same then you always have them the same, if it can be random then select them random each time.

What do you mean by objects?

In that particular game you would probably consider each block to be some sort of entity, which when broken may release some sort of power-up randomly. For that I would make the blocks a class, and have a member function called "destroy()" which chooses whether or not to spawn a power-up entity which could then be added to some sort of global entity list for tracking.

On the other hand, games like first person shooters or RPG's may require specific objects to be at specific locations all the time. In that case normally the map data will include a list of such entities, specifying what type they are, the location, and any applied attributes. This could also be used for the construction of the blocks in your game.

On a completely different topic, there is a similar game called "Jarindains!" that's pretty fun.

The usual solution is to have a datafile that contains information about the objects in the level. Your code reads in the datafile and creates the objects.

For an arkanoyd type game the format could be very simple - a text file with one line per block, containing color, x-pos, y-pos, powerup (if any). More complex games could need a structured format such as XML.

Making the level data a text file means you can get up and running quickly by hand editing it. Later you can write a level editor that lets you design the level visually and saves out the level data into a file ready to be read in by the game code.

Dave

Ya.. so far I have the objects done.. and all right along with posX, and posY.. I was wondering.. since Im fairly new at this game creation... Anyone Im going to zip up what I have so far for my game.. maybe I can get some comments on it before I can continue... Also note that It will not have the bar on it yet.. it will just be the block objects.. and a red window on your right hand side.. but.. the ball is currently making all the actions :). But I would actually love some comment on it though..

(brb in a few)

hasn't it been a few? :D

Ya.. hehe Im actually getting an error on installing pythong distutils, Going over to post it at the python forum just hold on tight till I can get this working.. this way if you dont have pygame installed you wont need it.

haha!!!!! I said "pythong!!!" hehehe, sorry :P

Well Ok what ever, Im going to have to read on how to use distutils.. Dont have time for that right now. but anways.. Remeber the game is not done yet... Im still missing some objects.. this is just for testing and comments :)

Requirements: SDL, Python, Pygame, SDL-Mixer, Usualy most of these are already installed in your system, Also sorry guys.. but this is a Linux only for now :S, but I think it should also be ran on windows.

Well, I loaded it up on my box at home over vnc. Looked alright. The ball bounce isn't very natural. Looks like you just flip both the x/y direction when it hits a block. I don't know any pythong (or python either :)) so looking at the source would be a bit pointless for me.

Good job though.










privacy (GDPR)