#1
  1. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407

    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.
  2. #2
  3. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
    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.
  4. #3
  5. Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2006
    Posts
    264
    Rep Power
    124
    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.
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    London, England
    Posts
    1,585
    Rep Power
    1373
    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
  8. #5
  9. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    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)
  10. #6
  11. Psycho Canadian
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Jan 2001
    Location
    Canada
    Posts
    4,846
    Rep Power
    635
  12. #7
  13. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    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.
  14. #8
  15. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    haha!!!!! I said "pythong!!!" hehehe, sorry :P

    Comments on this post

    • para45 agrees : Been drinking? heh :)
  16. #9
  17. Only the strong survives!!.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Feb 2003
    Location
    A World of wonders.
    Posts
    5,583
    Rep Power
    407
    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.
    Attached Files
    Last edited by xlordt; July 3rd, 2006 at 09:26 PM.
  18. #10
  19. Wiser? Not exactly.
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    May 2001
    Location
    Bonita Springs, FL
    Posts
    5,944
    Rep Power
    4033
    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.
    Recycle your old CD's, don't just trash them



    If I helped you out, show some love with some reputation, or tip with Bitcoins to 1N645HfYf63UbcvxajLKiSKpYHAq2Zxud

IMN logo majestic logo threadwatch logo seochat tools logo