Jump to content


Member Since 24 Dec 2010
Offline Last Active Jun 20 2014 06:22 PM

#5152655 JMenu, Listeners, and drawing

Posted by ScoreX on 10 May 2014 - 03:16 AM

In the actionPerformed method of the ImageListener class, you are comparing the text of the event source to the JMenuItem object, instead of the text of the object.


Instead of

    outputTextArea.replaceRange(descriptions[0], 0, outputTextArea.getText().length());
    pictureLabel.setIcon(new ImageIcon("images/" + pictures[0]));


    outputTextArea.replaceRange(descriptions[0], 0, outputTextArea.getText().length());
    pictureLabel.setIcon(new ImageIcon("images/" + pictures[0]));

#5136787 Turn based VS Real time strategy games and Total War series

Posted by ScoreX on 06 March 2014 - 07:28 AM

The main difference is in the name... One takes place in real time, while the other takes place in turns.


In terms of programming, the difference is that for RTS you will need to be constantly updating/drawing. For TBS, you only need to update when something occurs e.g player hits end turn, so now we calculate the next AI players moves.


Have you played a Total War game? It's pretty obvious how they make use of both systems. The turn-based portion takes place on a large world map, where you move your armies and create castles/cities and the real-time bit is for battles where you fight on a smaller map with 2 or more armies.

#5135727 The Pygrid Engine (Pygame)

Posted by ScoreX on 01 March 2014 - 04:02 PM

Looks like a good start smile.png


Just some feedback on your code style:

  • For modules, classes, methods and functions you might want to use python docstrings instead of using '#'. A docstring is much more useful as any decent IDE can show it to you without you needing to visit the file to read the comment.
  • It's generally not good python style to use import *. Better to import exactly what you need so there is no ambiguity. ( e.g, the "init" function in main.py, where is that defined? Is it pygame, random or pygrid? ( I know it's pygame in this script, but as your codebase grows bigger, you might want to provide your own init()  ) )
  • I know it's only a demo script, but all the "global" code in main.py would look a lot nicer grouped into a function ( or an if __name__ == "__main__" ), just to make it more readable. As it is, you kinda need to jump around to follow the code.


You don't have to take any of this on board of course, the code will work regardless. At work we develop primarily in python and it's great working with clean documented code when using 3rd party packages. These would be things I would be looking out for if I was searching for a python engine to use making a game.


All the best with this endeavour smile.png

#5061762 c#

Posted by ScoreX on 14 May 2013 - 06:31 AM

He is talking about C# 5 which does exist as it was released with .net 4.5



As for which book to get, it's difficult to say. I would look at reviews for both and see what people have to say. Keep in mind that neither choice is a wrong choice. I would recommend going for the version 4 book ( it'll probably be cheaper ) unless the newer copy happens to teach it in a better way. You can always use web resources once you've finished learning the features in version 4 to learn version 5 afterwards.


As for Visual Studio versions, you can always use the latest Express Edition which will allow you to use features from the newer version of the language for free at http://www.microsoft.com/visualstudio/eng/products/visual-studio-express-products