Jump to content


Photo

How do I create two scores


  • Please log in to reply
6 replies to this topic

#1 Super-Mario1

Super-Mario1

    GMC Member

  • GMC Member
  • 32 posts

Posted 13 May 2011 - 06:14 PM

Hello I am making a game called Little Blob's Big Sports. In this game there will be a mixture of sports to play, however I have gotten stuck.

In this multiplayer football based mode here is a screenshot of what I have created:

Posted Image


Has you can see the aim of the game is to bounce the ball of your chosen character and into the colour of your blobs net.

How would I go about creating two seperate scores, and setting a target score.

E.g.

When black scores goal 1-0
When White scores goal 1-1
When black/white scores 5 goals a message saying that the black/white blob wins and the game will return to the main menu room.

Thank you if you can help

Edited by Super-Mario1, 13 May 2011 - 06:14 PM.

  • 0

#2 FortyEightKay

FortyEightKay

    Commercial Developer

  • GMC Member
  • 966 posts
  • Version:GM:Studio

Posted 13 May 2011 - 06:18 PM

Hello I am making a game called Little Blob's Big Sports. In this game there will be a mixture of sports to play, however I have gotten stuck.

In this multiplayer football based mode here is a screenshot of what I have created:

Posted Image


Has you can see the aim of the game is to bounce the ball of your chosen character and into the colour of your blobs net.

How would I go about creating two seperate scores, and setting a target score.

E.g.

When black scores goal 1-0
When White scores goal 1-1
When black/white scores 5 goals a message saying that the black/white blob wins and the game will return to the main menu room.

Thank you if you can help


In create event
global.black_score=0;
global.white_score=0;


In black Goal event

global.black_score=global.black_score+1

in white goal event
global.white_score=global.white_score+1


Then check if either has 5 goals and declare winner!

48K
  • 0

#3 Super-Mario1

Super-Mario1

    GMC Member

  • GMC Member
  • 32 posts

Posted 13 May 2011 - 06:26 PM

[/quote]
In create event
global.black_score=0;
global.white_score=0;

check if either has 5 goals and declare winner!

48K
[/quote]

In first step does this create event go into a new object with nothing in it and:
How do I to check.

Thanks in advance

Edited by Super-Mario1, 13 May 2011 - 06:32 PM.

  • 0

#4 Awesomeness

Awesomeness

    GMC Member

  • New Member
  • 367 posts

Posted 13 May 2011 - 07:19 PM

Yeah, you put it another object. It's sort of a control object that you can't see, but it holds all your variables for you.
To see it, just put this in the draw event of that object (and make sure there's no sprite for this object or it won't work.)
/* draw_text(x,y,string) */
draw_text(50,50,"Black:" + string(global.black_score))
draw_text(50,65,"White:" + string(global.white_score))
What it is: draw some text at x-coordinate 50 pixels to the right, 50 pixels down (or 65, in the second one), and then draw the string that will show up, plus the variable. The string() part is to convert it to a string, otherwise it won't show up.

Hope that helps!

- Awesomeness
  • 0

#5 Super-Mario1

Super-Mario1

    GMC Member

  • GMC Member
  • 32 posts

Posted 13 May 2011 - 07:51 PM

Thanks everyone it has worked great now how do make the game say well done to the character which scores 5 points first.
  • 0

#6 Awesomeness

Awesomeness

    GMC Member

  • New Member
  • 367 posts

Posted 13 May 2011 - 07:56 PM

Thanks everyone it has worked great now how do make the game say well done to the character which scores 5 points first.


Add this to the draw event
if global.black_score==5
{
draw_text(room_height/2,room_width/2,"Black wins!")
/* Use room height or view height, it doesn't matter. */
}
if global.white_score==5
{
draw_text(room_height/2,room_width/2,"White wins!")
}

- Awesomeness
  • 0

#7 Super-Mario1

Super-Mario1

    GMC Member

  • GMC Member
  • 32 posts

Posted 13 May 2011 - 09:17 PM

One problem I have noticed during the whole process is that:

If white scores 2
Then black scores 1

Then the score changes to:

1-0

The points the white earned is reset.

I hope you can understand the issue everything else works perfectly though, thank you.

Edited by Super-Mario1, 13 May 2011 - 09:18 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users