How to make a score step by step tutorial

Learn how to make certain types of games and use gameEditor.

How to make a score step by step tutorial

Postby zxcvbnm » Wed Sep 08, 2010 12:14 am

Ok for this tutorial , we need 3 actors .
Please name your actors exactly as follows

Player
coin
score

Now let set the score actor 1st . That will makes this process a breeze.
Click on score
Now look on the actor control panel on the top part there is a tab that says Text .
Click on the Text tab , and another window opens up.
Now look for the tab that says New Font
Click true type

Click file tab and choose a font
Size your score to 50 or 60
change the color if you want

Now click ok
In the space type 0000
Now click ok.
That concludes setting up the text actor .
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: How to make a score step by step tutorial

Postby zxcvbnm » Wed Sep 08, 2010 12:19 am

Now we are going to set up the scoring. In this example when your player hits the coin , your score will go up by 10 pts.

Click on your player
click on collision

on any side of
coin
repeat no

Now click add action // script editor // and type this in //

score.textNumber=score.textNumber+10;

Click ok // immediate action.

Now your done setting up your score.
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: How to make a score step by step tutorial

Postby zxcvbnm » Wed Sep 08, 2010 12:24 am

Now this is an addition to the tutorial posted . If you want the coin to be destroyed when you collect it , follow this method.
Click on player
click on collision
choose the coin // click add action // click destroy actor // choose "collide actor" press ok and immediate action.

Now if you have any questions feel free to ask.
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: How to make a score step by step tutorial

Postby NightOfHorror » Thu Sep 09, 2010 11:51 pm

Can you somehow change the coin into a enemy space ship that attacks. Can you also make it where when my space ship shoots when the bullet collides with the enemy ship destroying it, it also makes my score go up by 10. Thanks
viewtopic.php?f=2&t=12136
"I have not failed. I just found 10,000 ways that wont work." quoted by Thomas Edison.
Over the year, I decided my motto for me is I am knowledgeable, but not practical.
User avatar
NightOfHorror
 
Posts: 1823
Joined: Fri Aug 27, 2010 2:50 am
Location: Cedar Hill, MO, of the USA
Score: 51 Give a positive score

Re: How to make a score step by step tutorial

Postby zxcvbnm » Fri Sep 10, 2010 2:34 am

NightOfHorror wrote:Can you somehow change the coin into a enemy space ship that attacks. Can you also make it where when my space ship shoots when the bullet collides with the enemy ship destroying it, it also makes my score go up by 10. Thanks


Yes this command is universal , you dont have to use the exact actors that I used in this example. This is the easiest way I can explain it to you. There is no simpler way.
Check out Momo AlienStarcatcher , featured in apples new and noteworthy and has 5 star reviews!!!
http://itunes.apple.com/us/app/momo-ali ... 61779?mt=8
zxcvbnm
 
Posts: 248
Joined: Sun Aug 22, 2010 7:57 pm
Score: 10 Give a positive score

Re: How to make a score step by step tutorial

Postby yourownskill01 » Fri Apr 12, 2013 9:08 pm

I did something similar to this....how can I use this method and be able to save the coin info if lets say I do a Load Game?
yourownskill01
 
Posts: 7
Joined: Thu Apr 11, 2013 7:04 pm
Score: 0 Give a positive score

Re: How to make a score step by step tutorial

Postby Zivouhr » Sat Jul 05, 2014 7:07 pm

Thanks for posting this info on scores; it's a help.
One suggestion, for beginners, would be to also include the coding required for getting bonus lives with hitting enough points from multiple enemies.


LCL offered the following coding tip for the above addition:

viewtopic.php?f=4&t=7025&hilit=plz&start=15
Then, the score question.
There's one thing you'll have to fix right away. And that is the fact that you're trying to use textNumber as a variable holding the score. I know that the Game Editor's built-in caveman tutorial tells you to do this, but there is a reason why you should never use textNumber for anything else than showing numbers on the screen. And that is the fact that textNumber isn't reliable when you try to do coding with it. Even a simple if condition like the following one won't work:

Code: Select all
if (textNumber == 5)
{
DestroyActor("Event Actor");
}


All you have to do to get rid of this problem is to create a global integer variable named as you want, and then use this in the draw actor event of the text actor you want to be showing the score:

Code: Select all
textNumber = myScoreVariable; //myScoreVariable is an exapmle of the score variable name


Now you can do all the conditions, additions and subtractions with the myScoreVariable and it will be 100% accurate. Only use textNumber to show the value of the variable.

Then, for getting a 1-UP every time the score reaches a multiple of 1000, just use this code:

Code: Select all
if (myScoreVariable % 1000 == 0) //Check if the remainder of myScoreVariable equals 0. If it does, that means that myScoreVariable is evenly divisible by 1000, so it must be a multiple of 1000
{
myLivesVariable ++; //Notice that you'll want to get rid of using textNumber for storing lives, too. Oh, and "variable ++" means the same as "variable += 1"
}


Thanks. Scoring points is good, but without any bonus life rewards, not as meaningful.
City of Rott Game created on Game Editor http://cityofrott.wordpress.com/
User avatar
Zivouhr
 
Posts: 549
Joined: Sat May 17, 2014 2:12 pm
Score: 59 Give a positive score


Return to Tutorials

Who is online

Users browsing this forum: No registered users and 1 guest