• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

139 Neutral

About Andorien

  • Rank
  1. C++, items in game, dying here!

    Quote:Original post by Crisium hi, why don't you do it the other way around... every room as an ID (number associated with it) and every item has a member value telling it which roomID it belongs too. This method is also good if a person picks up an item you give the item the ID of the person so now you know the item belongs to person and the person can walk anywhere he wants and drop the item at anytime. my two cents, Peter Wraae Marino This is a neat idea, but there's an issue. It's a text based game where when the player enters a given room, you need a way of retrieving its contents so the player can properly "see" the room and interact with it. If the items simply floated around with a tag pointing to their room, in order to retrieve all the items in a given room, you'd have to search a list of all the items currently created for the correct room ID. If you have many many rooms with many many many items, this could get silly. Using the current way, when he wants to display a room and all it's contents, all he needs to do is query all the items contained in the room object.
  2. C++, items in game, dying here!

    Quote:Original post by Kalten Quote:Original post by Andorien I think that in his case, there's no real reason to use char* rather than std::string. It'll make his life much easier. Further, I think using std::vector would be better than the simple arrays, as then he wont have to worry about how many objects he shoves into a room at runtime. I agree. I just cant think of how to write it in vectors atm... Let me take a swing. My C++ is rusty (too much C#), and I'm not sure if this'll cause a memory leak, but let's try this: class item { public: std::string name; item(const std::string& inputName) { name = inputName; } }; class room { public: std::vector<item> Items; }; std::vector<room> Rooms; Rooms.resize(10); Rooms[0].Items.push_back(item("table")); //room 0's item 0 is a called a table.
  3. C++, items in game, dying here!

    I think that in his case, there's no real reason to use char* rather than std::string. It'll make his life much easier. Further, I think using std::vector would be better than the simple arrays, as then he wont have to worry about how many objects he shoves into a room at runtime.
  4. xna ..what exactly is it ?

    Let it be said that while it is indeed "simplified", it's still plenty powerful. The only thing I can think of that it doesn't allow really is using DirectX10. Also, it stands for XNA's Not Acronymed.
  5. this is my first time question here

    You can setup everything directx needs to get going using SDL, without touching any WinAPI code at all.
  6. warlords and opengl

    Also, MS themselves never wanted you to use directinput for keyboard/mouse input in the first place, since for them it's just a wrapper around standard windows input.
  7. Alternatives to global?

    Something to also think about is the issue of code reuse. If your functions and classes rely on global variables contained in the program, it'll be difficult to try and reuse those functions for other programs, or even other parts of the same program that might want to work with different data. Passing all the data back and forth might seem repetitive and inefficient, but in reality it keeps your code flexible and prevents it from turning into a huge mess, especially if you need to come back, look at the code again, and try to figure out what all these global variables are.
  8. XNA - Alpha channels and SpriteBlendMode

    IIRC, in order to get that last effect, you'll need to depth sort the sprites in the opposite order that you draw them. Basically, both will have 75 or whatever alpha channel value. You draw the blob first, then the rectangle. However, in the SpriteBatch.Draw calls, you need to depth sort them so that the rectangle is on the bottom and the blob is on the top.
  9. Sprite collision at higher movement rates

    Basically, instead ofObjectPosition += MovementAmount; CheckCollisions();you have something more likefor(int i = 0; i < MovementAmount; i++) { ObjectPosition++; CheckCollisions(); }
  10. How to handle gamestates

    I actually created a GameScene/SceneManager system similar to your's in the tetris game I recently made, using the push/pop structure. Since I'm using XNA, things were a little easier, but the concepts should remain the same. Basically, the SceneManager handled updating and drawing all the GameScene objects in the stack. When a new one is pushed to the stack, the GameScene right under the new one is disabled (so the update function wont be called), and may be set to invisible depending on if the Push() function was supplied true or false (true if you want to hide the underlying GameScene, false if otherwise). If it's set to be invisible, then its Draw() function wont be called. To get the game started, you create a new SceneManager, push the first GameScene to the stack (which in turn will probably push new GameScenes, which will push and pop more GameScenes, and so on), and then just call SceneManager's Update() and Draw() functions.
  11. Stuck on a Pygame Tetris

    In my (albeit) limited experience, you should do things in the way that is easiest to write and maintain. If there's a problem, then you go back and change it. Just work on getting things on screen and working, and get things fine tuned as you go. As you get more experienced, you'll have to rewrite code less and less. For rotation, in my Tetris clone, I used the former method. It was faster to prototype and get working, and gave working results. Obviously, if you needed more than 4 directions this would be different, but with Tetris I think it's appropriate. For your second issue, I'll basically describe the method I used. The play field grid array only really keeps track of the blocks that have already been "set". The currently falling block's location inside the grid is kept, and each time it moves down, it checks below the active block for any set blocks in the way. If there are, it adds the active block to the grid and spawns a new block. Note that when you add a block to the set grid, you don't copy the shape, so much as the 4 brick locations and colors, so they can be easily taken apart later.
  12. Play and criticize my crappy game!

    Thanks! I just did as you suggested, and submitted it to XnaProjects.net Right now, I'm trying to decide what to make next. I've got it narrowed down to: Vertical shooter (like Tyrian) Sidescrolling platformer 2D Chu Chu Rocket clone (Link for those unfamiliar with the game)
  13. Play and criticize my crappy game!

    Really, I'm not sure how changing resolutions or going fullscreen would work. I'm using sprites, so everything is sized for the current window. A change in resolution creates more viewing area that I'd have to handle. The actual play area with the blocks is just centered, and the information stuff can be set to an offset from the center, but things like background images for both the main game and the menu would have to be scaled, and probably end up not looking so good.
  14. Play and criticize my crappy game!

    Alright, I just installed 2.0, and it has them both installed side by side, so it acts like the .Net Framework 1.1 and 2.0. You should be able to install 1.0 Refresh without messing 2.0 up.
  15. Play and criticize my crappy game!

    Installing the 2.0 redist now, gonna see what happens.
  • Advertisement