repeat rolling dice

Started by plebeo, Mon 12/02/2007 15:51:43

Previous topic - Next topic

plebeo

maybe is simple thing!!
But I search in the topic and not find something helping!!

This is the question:

it's a dice match!

Who have the more high dice is the winner!!

I use variables, random command etc.


After the first match how can I repeat that event again ?

Ashen

By redoing whatever you did in the first place? It sounds like you've got the coding working, you just can't start a second game - is that right?

It would depend on how and where you've got the first match happening (when you press a GUI button, enter a room, etc) but retriggering that should start a new match. It may also depend on how you've coded it - e.g. do you need to reset the variables to 0 before it'll run?

Again, be more specifc about where the problem actually is, to get more useful answers.
I know what you're thinking ... Don't think that.

Akatosh

That depends on how you're triggering it. If I was you, I'd just make a "Next Match" button/object/... and put the code into "Any click on ..."

(dammit, Ashen, stop being faster than me)

plebeo


the game plays suddenly when we enter the rooms!!

I need the match restart by itself (without press any button) and keeping the variables of the two player.

I mean:

player1 wins the first match, then have 1 point, the match have to restart.

The first of two player who arrive to 3 points wins and game must end.


That's what I need!!

Akatosh

Just

(code for first match)
(code for second match)
(code for third match)

You could put that into a function, yes, but I prefer the old-fashioned way  :=

Khris

Code: ags
int player1points;
int player2points;

while(player1points<3 && player2points<3) {
  // dice match code
  // increase player1points / player2points by one
}
if (player1points==3) {
  Display("Player 1 wins!");
}
else {
  Display("Player 2 wins!");
}

SMF spam blocked by CleanTalk