Thread: structs on a game

  1. #1
    Registered User
    Join Date
    Jan 2015
    Posts
    2

    structs on a game

    Hello everyone and happy new year!!
    I am here just for some programming hints on a game I want to create..

    I actually need to create a labyrinth and a player who needs to go thru the map collecting objects (like bags, water etc...).
    I planned to do the map with a bidimentional array (5x5) but I dont know how to put different objects on an index.. Ex: array[3][2] will have a Botte of water and an energy bar..

    Someone told me to use structs but I dont really understand how this would work... I've tried so many times bit I cant do it...

    If someone could post a simple example or something I would be gratefull!!

    Thank you

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,662
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    1,114
    Quote Originally Posted by macacomacho View Post
    Hello everyone and happy new year!!
    I am here just for some programming hints on a game I want to create..

    I actually need to create a labyrinth and a player who needs to go thru the map collecting objects (like bags, water etc...).
    I planned to do the map with a bidimentional array (5x5) but I dont know how to put different objects on an index.. Ex: array[3][2] will have a Botte of water and an energy bar..

    Someone told me to use structs but I dont really understand how this would work... I've tried so many times bit I cant do it...

    If someone could post a simple example or something I would be gratefull!!

    Thank you
    You need to show us an example of what you wrote so we can comment on it. This will help us know what you were thinking and offer suggestions. We can't/won't write the code for you.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 2
    Last Post: 01-08-2013, 07:55 AM
  2. Typedef Structs inside Typdef structs
    By gremory in forum C Programming
    Replies: 21
    Last Post: 12-30-2011, 07:48 PM
  3. [ noob question ] Help with structs within structs
    By Riverfoot in forum C Programming
    Replies: 3
    Last Post: 04-26-2011, 07:24 PM
  4. Passing Structs Into An Array Of Structs.
    By TheTaoOfBill in forum C Programming
    Replies: 3
    Last Post: 10-07-2010, 09:38 AM
  5. passing structs & pointers to structs as arguments
    By Markallen85 in forum C Programming
    Replies: 6
    Last Post: 03-16-2004, 07:14 PM