SgtMe 46 Veteran Poster Featured Poster

Please be clearer in what you want to do. You want a game to make in C++, that's not tic-tac-toe? How about space-invaders, asteroids, pacman...do a google search for classic arcade games and make a clone.

SgtMe 46 Veteran Poster Featured Poster

Try downloading the source package of wxPython.
Then run setup.py install from the command line.

SgtMe 46 Veteran Poster Featured Poster

410

SgtMe 46 Veteran Poster Featured Poster

412

SgtMe 46 Veteran Poster Featured Poster

Yup :) Well...if not then host it externally at like http://www.mediafire.com or somewhere.

SgtMe 46 Veteran Poster Featured Poster

subterfuge -> fuselage (just sounds similar :/)

SgtMe 46 Veteran Poster Featured Poster

416a

SgtMe 46 Veteran Poster Featured Poster

^ :)
< gotta go play tennis
V seeya later :)

SgtMe 46 Veteran Poster Featured Poster

I ended up doing it in C++ seeing as I couldn't compile my code with Py2exe. Here's the thread:
http://www.daniweb.com/forums/thread330291.html

Here's the C++ code: [B][I][U]C++ SYNTAX!!![/U][/I][/B]

#include <iostream>
//for strings
#include <string>
//for c_strings
#include <cstdlib>
//standard namespaces
using namespace std;

//we need these args. for main
int main(int argc, char *argv[])
{   
    //file path of script. NOTE THE SPACE!!!
    string toCall="<Edited out the path>\test.py ";
    //path to opened file (opened with right click -> open with...)
    string file=argv[1];
    //add the strings, this will create "<path>/test.py example.txt"
    string finalCall = toCall + file;
    //call from CMD (windows only)
    system(finalCall.c_str());
}

And here's the bit of python code you need:

//needed to get system args
import sys
//incase we opened the script without having a value
//for argv[1]
try:
        //open the file in "argv[1]", which in above C++ code
        //is "example.txt"
	file = open(sys.argv[1], "r")
//on epic fail
except:
        //exit the program
        sys.exit

Basically, you are just using the command test.py example.txt , which can be done from the command line. I only made an exe so I could then make it so I can double click on the file and open it.

Unfortunately, when I added that in (which now works), I managed to break something else in the script so I've got to try and fix it all now.

Please upvote if this helped :)

SgtMe 46 Veteran Poster Featured Poster

Please upvote my post seeing as it was helpful :)

SgtMe 46 Veteran Poster Featured Poster

Please upvote my post seeing as it helped :)

SgtMe 46 Veteran Poster Featured Poster

bribe -> pilfer

SgtMe 46 Veteran Poster Featured Poster

476 not on my watch ;) well maybe...but hey...

SgtMe 46 Veteran Poster Featured Poster

Your probably best of leaving your project for a bit. If you haven't done graphics before, go here:
http://www.cppgameprogramming.com/cgi/nav.cgi?page=index
(double-click anywhere to bring up the site menu)
and learn allegro. Make pong or space invaders or something first, then go back to do your project. Basically just keep your existing logic, but get rid of all the printing to the console and replace it with graphics. It will be fairly hard to do. Depending on the size of your game, you may want to consider re-writing it around allegro.

skorm909 commented: Helped me out. +1
SgtMe 46 Veteran Poster Featured Poster

I think allegro is a good place to start. It's fairly primitive, but it should be advanced enough to make some good little 2D games, as long as you know what your doing with it. Not sure what you mean about PyGame not being documented very well. There are loads of examples and a full documentation of all the functions. I got along fine with it, and I'm now using PyOpenGL with it as well.

SgtMe 46 Veteran Poster Featured Poster

This works for me:

import random
import os

def main ():

    #declare variables
    compNumber = 0
    playNumber = 0
    tie = 0

    playGame = findWinner(compNumber, playNumber, tie)
    os.system("pause")



def findWinner(compNumber, playNumber, tie):

    compNumber = random.randint(1, 3)
    print "Player1, please select your choice."
    playNumber = int(raw_input('1 for Rock, 2 for Paper, or 3 for Scissors: '))
    print "The computer chose: ", compNumber

    if compNumber == 1 and playNumber == 3:
            print "Computer wins - Rock smashes scissors!"
            tie = 0
    elif compNumber == 1 and playNumber == 2:
            print "Player1 wins - Paper covers rock!"
            tie = 0
    elif compNumber == 2 and playNumber == 1:
            print "Computer wins - Paper covers rock!"
            tie = 0
    elif compNumber == 2 and playNumber == 3:
            print "Player1 wins - Scissors cut paper!"
            tie = 0
    elif compNumber == 3 and playNumber == 1:
            print "Player1 wins - Rock smashes scissors!"
            tie = 0
    elif compNumber == 3 and playNumber == 2:
            print "Computer wins - Scissors cut paper!"
            tie = 0
    elif compNumber == playNumber:
            print "TIE - You must keep playing for a winner!"
            tie = 1
    
    return tie

#calls main
main()

I think I changed something else, but the main thing I noticed is line 20 in my above code. I added int() around the raw_input() to make sure that it converted to int. That was probably it.

SgtMe 46 Veteran Poster Featured Poster

For each snake, you should store the starting position and the ending position. If the user hits the starting position, then they 'teleport' to the ending position (ie, they go from the top to the bottom).
For each ladder, you should store the starting position and the ending position. If the user hits the starting position, then they 'teleport' to the ending position (ie, they go from the bottom to the top).
You could try storing these in a couple of arrays.
ie. "startingPositions" and "endingPositions", where the index of each array value in both arrays (ie. index of 2) corresponds to the same ladder/snake (ie. "startingPositions[2]" and "endingPositions[2]" correspond to ladder/snake number "2".
For the movement, you could simply change the players position to the top of the ladder.

SgtMe 46 Veteran Poster Featured Poster

LOL that's not long! You only need to upload it if it's like, oh I don't know, let's say...200+ lines. Generally people won't read a longer code like that.
I need you to upload "functions.txt" 'cos your code uses that and I have no idea what it looks like/does.

SgtMe 46 Veteran Poster Featured Poster

ghost ship -> pirate ship

SgtMe 46 Veteran Poster Featured Poster

480

SgtMe 46 Veteran Poster Featured Poster

Questions:
1: What do you mean?
2: Do you expect us to do it for you?

GUID: WEORINWEIONR-WERJNOWJENR-23409230489088wh-asdasdon
Control: Me
File Name: This thread is pointless

SgtMe 46 Veteran Poster Featured Poster

476

SgtMe 46 Veteran Poster Featured Poster

478

SgtMe 46 Veteran Poster Featured Poster

You won't. How many lines is it? If it's more than about 350 then you would want to upload and attach it. Definitely attach if it's in more than two or three files. If not, then consider splitting it into more files so you don't end up with one long piece of code.

SgtMe 46 Veteran Poster Featured Poster

You'd probably be best playing it, as I only saw a friend playing it and had a look on the internet later. But when you run it, don't choose to generate a world. It's good, but it takes ages. Use a pre-made world.

SgtMe 46 Veteran Poster Featured Poster

censors -> censorship

SgtMe 46 Veteran Poster Featured Poster

^ This symbol is up.
< I'm tired, 'innit'.
V seey'all tomorrow :)

SgtMe 46 Veteran Poster Featured Poster

"Innocence" - Halestorm

SgtMe 46 Veteran Poster Featured Poster

Ouch. Gone down since I last saw it...
478

SgtMe 46 Veteran Poster Featured Poster

Well post the code. We can't help without it!
Well people lie about things not being school assignments ;)
Anyway, I wouldn't help someone who didn't show effort regardless.

SgtMe 46 Veteran Poster Featured Poster

We won't write the code for you. We will help you if you show us effort. Sorry, but it's the rules.

SgtMe 46 Veteran Poster Featured Poster

Have a look at this. Not sure how helpful it will be, but it has some description or another on the page:
http://www.codeproject.com/KB/applications/xcmyk.aspx

SgtMe 46 Veteran Poster Featured Poster

Agreed. Angry birds is great fun.

SgtMe 46 Veteran Poster Featured Poster

pre-historic -> ancient

SgtMe 46 Veteran Poster Featured Poster

508

SgtMe 46 Veteran Poster Featured Poster

Welcome :D

SgtMe 46 Veteran Poster Featured Poster

I haven't got an iTouch (yet), but I played World At War: Zombies on a friends and it will awesome.

SgtMe 46 Veteran Poster Featured Poster

502

SgtMe 46 Veteran Poster Featured Poster

504 :)

SgtMe 46 Veteran Poster Featured Poster

extant -> extinct

SgtMe 46 Veteran Poster Featured Poster

Awesome!!! Well done team!!!
Well I'll start it at 500 :)

SgtMe 46 Veteran Poster Featured Poster

Cheers :D Works great :)

SgtMe 46 Veteran Poster Featured Poster

You mean 956?
958

SgtMe 46 Veteran Poster Featured Poster

I have made a python program which will create an OpenGL and render a teapot (GLUT standard teapot) with a shader that I specify. The shader is specified as follows:

  • I have a file called "index.ini" which contains the file paths to a vertex shader and pixel shader file
  • The program gets the contents of "index.ini" using "sys.argv[1]"
  • I run the program from CMD with the following: "test.py index.ini"

I want to be able to right click on "index.ini" and open it by default with a C++ program, which will get the path to "index.ini" through "argv" and pass it to CMD, where I can make a call such as "test.py index.ini", using "system()". I have tried the following, but the program just hangs and then crashes.

#include <iostream>
#include <string>
#include <cstdlib>
using namespace std;

int main(char *argv[])
{
    string toCall="<PATH>\\test.py ";
    string file=argv[1];
    cout<<argv[1]<<endl;
    system("pause");
    string finalCall = toCall + file;
    system(finalCall.c_str());
}

Thanks :)

SgtMe 46 Veteran Poster Featured Poster

?!
810

SgtMe 46 Veteran Poster Featured Poster

being -> existing

SgtMe 46 Veteran Poster Featured Poster

Don't worry about that last post. I managed to get it to work from CMD. Now I'm writing a batch script/exe so that I can run it on double click.

SgtMe 46 Veteran Poster Featured Poster

802

SgtMe 46 Veteran Poster Featured Poster

people -> person

SgtMe 46 Veteran Poster Featured Poster

I managed to get that working with a test script:

import sys
import os
for arg in sys.argv:
    print arg
os.system("pause")

I had to use py2exe to compile it to exe, as I couldn't get it to work as a python script. I implemented this feature in my main program, but that won't compile with py2exe.

Looking at the code above, is there a way that I can double click on this so it will run and read the contents of "sys.argv" into the file?