Computer Science Canada

Process/Image Problems

Author:  1 + 1 = 2 [ Sun Jun 06, 2004 7:30 pm ]
Post subject:  Process/Image Problems

Hi, I've spent the last hour browsing the turing forums, so I am really sorry if this is a repeat topic/already part of any help FAQ. If it is, would you mind providing me with a link before closing?

Anyway, I'm remaking Space Invaders for a school project. My teacher wanted me to make it using a process structure, so I did.

Basically, my program works like this... a menu comes up, the user clicks play, and the program goes to a procedure, which forks all the processes.

However, I am at the stage now where I have to make the user lose or win by loading a new screen into the program output when the user loses/wins.

Like for example, when all the aliens die, I want the entire output screen to clear, and then to load a picture saying "You win!".

However, one of two problems occur:

1. The pictures of the user's ship, the alien's, the health bar, etc. appear with the 'win'/'lose' picture... so it's like 5 pictures loading at once, all flashing.

2. The 'win'/'lose' picture doesn't load at all. Sad

So my question is: is there any way to allow a new screen to come up if your program is mainly composed of processes? Can you diable the processes? Is there any way to make my program work?

Thanks for any help. Very Happy

Author:  SuperGenius [ Sun Jun 06, 2004 7:36 pm ]
Post subject: 

if your process uses a main loop, you could just say

code:

process blah
    loop
        exit when gameover
        %your code here
    end loop
end blah


where gameover is a boolean variable that is set to true when you want to end the game

Author:  Mazer [ Sun Jun 06, 2004 8:12 pm ]
Post subject: 

Er... are you sure the teacher wanted you to do the entire game using processes?

Author:  1 + 1 = 2 [ Sun Jun 06, 2004 9:41 pm ]
Post subject: 

@Super Genius - Thanks for the advice, and I tried it, but I need the output window to load a new pic that says "Game Over". Your method simply causes the program's output window to close. Sad

@Mazer - Not the entire program. He just said we had to used process. We didn't want to use it at all.

Any further help will be great =)

Author:  meow? [ Sun Jun 06, 2004 9:43 pm ]
Post subject: 

I think hes trying to ask if there is any way to make a process stop working without exiting the loop inside the process.

Author:  AsianSensation [ Sun Jun 06, 2004 11:14 pm ]
Post subject: 

what the what?

anyways, to automatically stop a process, stick a return in there somewhere.

Author:  Mazer [ Mon Jun 07, 2004 6:34 am ]
Post subject: 

One way, if you don't want to stop the program completely is to have a loop somewhere in the process
code:

loop
    exit when keeprunning = true
end loop

Where keeprunning would be a global boolean variable set to false whenever you want to pause the process. Just don't forget to initialize it to true before you fork the process.


: