Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 30 Jun 2009
Offline Last Active Aug 21 2016 11:48 AM

Posts I've Made

In Topic: Environment for Python?

12 February 2014 - 02:14 PM

Hi cgeo,


If you're using Windows, you can use the IDLE IDE that ships with Python. It's not the most beautiful thing in the world, but it's already there. Just open it up and create a new file with it. You can run it natively in IDLE, so that's a good start.


If you're not on a Windows machine or you don't like IDLE (I wouldn't blame you, really), then you need to create and edit your Python programs in a text editor. I personally prefer SublimeText, but Notepad++ works just as well. Just save your file with a ".py" extension. To run a Python program on Windows, you can either navigate to the file in Windows Explorer and run it - this will open up the command line like you've already seen, or you can (and this is my personal preference) right click on it, "Edit with IDLE" and run it from there. It's not the most elegant solution, but IDLE provides good feedback on errors and won't just close when the program terminates for one reason or another. If you're on a Mac or *NIX, open up a terminal and run "python filename.py" where "filename" is whatever you named your file (prepended by the directory it's not in your current working directory).


I hope this helps!

In Topic: Pygame importing images

06 January 2014 - 06:39 PM

You just need to make sure you know where the root folder of your game is - i.e. make sure you know the structure of the files and folders and they are all contained in a single folder. Say you have "C:\Users\user\Desktop\Game" and the entirety of your game, including the images and code, are in Game. Say your code is in "Game\code" and your image is in "Game\images\Entities", you can load the image with the following:

image = pygame.image.load("..\\images\\Entities\\image.png")

Where the ".." tells the computer to check what directory you're in right now and go up one level - in this case, the computer sees you're in the code directory, goes up to the Game directory, then follows the remaining path. If the image is in a subdirectory of the directory the code is in, just use a single ".". If you need to go up multiple directories, add a "..\\" for each level you need to go up.

That way it doesn't matter where on the computer the entire folder is stored, as long as the files are in the same position relative to one another.

In Topic: Where to find or what to do to teach basic to a child.

14 December 2013 - 12:43 PM

If you're not absolutely set on teaching BASIC, but just some form of programming, this ebook does a nice job of explaining the basics of Python, which is fairly intuitive and more modern than BASIC: http://inventwithpython.com/chapters/

For a clean, up-to-date version of BASIC, without any sort of compiler or OS, you can use a programmable graphing calculator - my first programming was on a slightly older version of this one (I can't find the exact model number of the one I used, but this one is close): https://www.google.ca/search?q=casio+graphing+calculator&oq=casio+graphing+calculator&aqs=chrome..69i57j0l5.10151j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8#es_sm=93&espv=210&q=casio%20cfx-9850gb%20plus

You can find some instructions on how to use it here: http://support.casio.com/pdf/004/fx_plus_chapter20.pdf

In Topic: Best place to learn C++

07 December 2013 - 05:22 PM

Python's syntax really isn't that different when you get down to it. It's a little more intuitive in my opinion, and it'll be a nice stepping stone for you. It certainly doesn't spoon-feed you, but it's not as finicky as many other languages, so it should help you to get a handle on things without overly aggravating you. Good luck!

In Topic: Reaction fire problem (turnbased tactical game)

29 November 2013 - 01:47 PM

Just spitballing here - not sure if it fits with your game, but wouldn't grenades be the ideal weapon for the AI to use if the player tried concentrating their troops and not moving them?