Jump to content


Photo

highscore


  • Please log in to reply
6 replies to this topic

#1 slojanko

slojanko

    HARD GAMER

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

Posted 01 May 2012 - 05:49 PM

A game im making has many levels. At the menu where you select the leve you wish to replay, how to make when you move your mouse over a level it will show your previous highscore?
I thought of making variable for score for each level. what you think?

Edit: Won't it lag? If i have around 25 levels, and 7 objects that give score, then I would need 175 scripts for checking in which level the player is.

Also how would i check if the current score the player had is higher than the best score he has had? If I did it just by setting the score to 0 at start, the score that the player finished, would become the new highscore no matter if it was lower

Edited by original games, 01 May 2012 - 05:58 PM.

  • 0

#2 talonstart

talonstart

    Artist

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

Posted 01 May 2012 - 05:58 PM

Might wanna think of creating a ini / text doc script to hold all your saved highscores... that way it just looks to the ini, to highscore and shows it based on the level you have dragged over. .. if that makes sense.. Im still learning how to (script somthing like that).. but might be a direction to head towards.

Example..

(beat level)
score saved to a ini / txt..
(ini)
levelHS = 1,200,000
(over level select)
searches ini var shows # 1,200,000

something like that anyways... im not perfect .. dont laugh :)
  • 0

#3 slojanko

slojanko

    HARD GAMER

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

Posted 01 May 2012 - 05:59 PM

Sorry I've never done ini

Someone tell if this would work:

When players touches end object, the game would check:

If current_score_30 > highscore_30
highscore_30=current_score30

Then when player hovers the level, it would show highscore_30 for level 30

Edited by original games, 01 May 2012 - 06:08 PM.

  • 0

#4 slojanko

slojanko

    HARD GAMER

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

Posted 02 May 2012 - 05:38 PM

I think i got the solution, but its really really complicated:

Lets say the game has 3 levels.

At level selection menu, each level button would check if previous level is finished. Since none is finished player can only start with level 1. But before he does, control object in level selection does 0 to highscore and 0 to current score (global). When the player finishes a level, it would check:

if current_score_1 > highscore
highscore = current_score_1

But there is a problem with score. Since my game will use a different variable for each score, I cant use the same score variable for each level. Logical?
So here's what im thinking, collision event would check in which room the player is first:

COLLISION with object that gives score:

If player is in room_tut
give score to tut_score


But how to check in which room the player is?
  • 0

#5 Zwetbaba

Zwetbaba

    GMC Member

  • GMC Member
  • 87 posts
  • Version:Unknown

Posted 02 May 2012 - 06:14 PM

But how to check in which room the player is?

Just use the variabele "room":
if (room = room_tut) {/*Do something*/};
But actually you're doing it way too complicated. Your problem is easy to solve by using arrays for example.
The first thing you should do, is create highscore arrays to save the level highscores in. Like this:
var i;
for (i=1; i<=25; i+=1)
{
   global.highscore[i] = 0;
}
For the current score in the level itself you can easily use the built-in variable score. And at the end of each level you can use the code:
var level;
level = 18; // just an example

if (score > global.highscore[level])
{
   global.highscore[level] = score;
}
In this way, you can always easily check the highscores of each level by calling the variabele
global.highscore[ /*level number*/ ]
I hope that helps.

Edited by Zwetbaba, 02 May 2012 - 06:15 PM.

  • 0

#6 slojanko

slojanko

    HARD GAMER

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

Posted 03 May 2012 - 05:15 PM

I think I know the solution thanks to you.

But then there's another problem. I created a variable for each level, and this is what I did to add score in collision event with star:


if (room=level1_room)
{

with (star) {instance_destroy();}
global.level1_score=global.level1_score+25
}
  • 0

#7 slojanko

slojanko

    HARD GAMER

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

Posted 06 May 2012 - 05:57 AM

Bump

if (room=level1_room)
{

with (star) {instance_destroy();}
global.level1_score=global.level1_score+25
}

This code I used is suppose to work on level1_room. But it doesnt, even if player collides with star nothing happens.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users