Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!

1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Member Since 30 Nov 2005
Offline Last Active Jan 08 2012 07:46 AM

Topics I've Started

GUI Button - Handling Each Event

24 April 2009 - 01:42 AM

I'm just fooling around on making a GUI (that I will probably use in games later) and I'm wondering what type of approach is "best" for my situation. I'm going to have a Window and\or Panel object which will contain a collection of buttons and textboxs. It will then cycle through the collections to see if any has been clicked and then take the appropriate action. It's easy to handle whether or not if the button has been clicked but I cannot think of a good approach to "define" what each button does without having a whole bunch of: if(button1.isClicked()){ Do Action }else if(button2.isClicked()){ Do a different action } Ect. for every button. Perhaps this is one of the better\only ways to go about it or maybe I will have to redesign the Button class. Nevertheless, any help would definitely be appreciated.

Tagging a packet with what 'to-do'

18 December 2008 - 03:22 AM

Recently I started to fool around with online programming for games (or heck anything :P) and I'm just curious if I am going about packets the right way. So the example I will use will be an online game of pong. I can get it to work but it seems like there is a better way (I am too much of a perfectionist!) so I'd like some input. So let's say the up arrow and down arrow moves your paddle. Lets say one player presses the up arrow. I send a packet that does what you'd think it does: "Up" - Just for simplicity at this point I would send that. The server then goes throw a list of possible 'tags' the message can have and handles it accordingly. It will then send back a message to both clients telling it to update the position of one of the paddles. Truthfully I cannot think of any other type to do it (without a similar process) but having to tag each message and sending it to the server which has to search through code on how to handle it. I'm most likely just trying over-complicate this and if that's so, just tell me.

Referencing Objects When Creating a New Object

27 November 2008 - 06:16 AM

So I'm programming a game like Advance Wars so I have many different objects such as the camera, units, tiles, etc. A lot of the time I find I have to pass in a lot of the same parameters into methods of each object to do the "logic" of different objects. I was wondering, how bad of practice it is to just reference the objects in the constructor of each in order to avoid having to continuously pass in these parameters. I also ask because it feels like I am doing it incorrectly when I will call the draw method for my interface with a few things that, that methods doesn't use but rather a method it calls within itself (such as drawing a certain section of the GUI). If I'm not clear on what I mean just let me know. I am terrible with techincal names of things, but I think I used the correct terms.

Small Tetris Question

22 October 2008 - 11:47 AM

I'm curious if you can give me an idea for a more effective way to go about drawing the blocks that are already down. My current idea is to have a spot an array to correspond with a specific row and column. And each time through the draw method I will take the array, run it through a for loop, and draw a square for each spot in the array that isn't "empty". While this way would work, it seems as though there would be a "better" way to go about it. If anyone has any ideas\suggestions it would be appreciated.

Managing Many Sprites

23 April 2006 - 11:11 AM

Well, For a few days now I have been trying to think of a way inwhich I can manage many sprites of the same image. I have a book that shows a way to use tilesets (which definately helps make code easier to read\type) and sometimes I find myself using the same sprite but since using the tileset causes them to have the same name it moves\changes both of them. Now an easy but tedious way to go about it would be to obviously create many of that object but with different names. To me that seems like it is way too much work and there has to be an easier way. The type of thing I am trying to do is a game in which I will have to control many of the same type of sprite and it wouldn't be good if they all moved at the same time. I really don't have any code I can\should post because I am completely clueless on an effective way to do this so I am hoping you guys can help with me a good way. ~Thanks