Does anybopdy know how....

Non-platform specific questions.

Does anybopdy know how....

Postby Diana Kennedy » Sat Dec 31, 2005 5:35 pm

Hi!

I would like to know if there is a quick and dirty way to display the final score value in a new text actor.

My game finishes after 2 minutes by a timer which creates an actor that is a picture, saying "game over". And a text on it "your score:" I would like to create a textactor which displays the value of the score. I tried to move the score actor itself, but it did not work. I am pretty sure it just requires a little script in the newly created textactor to retrieve the value of the score. But, wel you know, me and scripting...Can anybody help me out?

Image
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Sun Jan 01, 2006 12:56 am

create a Var: score, put on the score actor(the one in game) put this script on draw actor:
Code: Select all
score=textNumber
and after the "your score:" is shown create an actor:score_2, then on draw actor
Code: Select all
textNumber=score


I hope it will work.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Diana Kennedy » Sun Jan 01, 2006 10:09 am

Game a Gogo wrote:create a Var: score,



Aehm...how?
Image

put on the score actor(the one in game) put this script on draw actor:
Code: Select all
score=textNumber




The "draw actor" is the actor that creates the "game over" actor?

I apologize for those probably ultra-stupid questions....
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Mon Jan 02, 2006 4:34 pm

there not stupid,i was in a hurry...

to create a Var (variable ) there is a place in the script editor you create a var, i tink its where you choose the button Variable.

end for the score tingy, its for the one that you see wille you play.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Diana Kennedy » Sun Jan 08, 2006 2:51 am

I tried, but it did not work.

Here is what I dod:

On the score actor of the game, in "draw actor, script editor, I added avariable "scory" It asked me a lot about the nature of the variable that I could not answer (integer, string, ???) then I I added

Code: Select all
scory=textNumber;


Then I made an actor "sore2" to be created when the final panlel "your score" appears. In this actor In draw actor - script editor I aded

Code: Select all
textNumber=scory;


It gives me an error message "underclared identifier scory"

:(
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Sun Jan 08, 2006 2:57 pm

did you click the add button when you add your Var??

and all the nature tingy in the window, i dont know that very well, all you need to do is: type in your Var name and then click add!!
its that simple, dont botter about the rest.
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Diana Kennedy » Sun Jan 08, 2006 3:16 pm

Game a Gogo wrote:did you click the add button when you add your Var??


Yes! The variable "scory" even shows in the user vars list. But as I said. It doesn't work. :cry:
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Sun Jan 08, 2006 3:18 pm

oh yeah, I fogot, you must put the string to global i ting...
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Diana Kennedy » Sun Jan 08, 2006 5:17 pm

Game a Gogo wrote:oh yeah, I fogot, you must put the string to global i ting...


?????? What? A little more detailed, please...
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Sun Jan 08, 2006 5:42 pm

srry, cant go more deep, my GE demo has expired. srry, im sure its not that.

did you put the two event as draw actor??
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby Diana Kennedy » Sun Jan 08, 2006 9:28 pm

Wouldn't you consider buying GE? You seemn to be comfortable with this software ;)

Yes, I putted the 2 events as draw actor!
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Game A Gogo » Mon Jan 09, 2006 12:32 am

I would, if I could.

My parents dont have a credit card and we cannot have one for like 5year or someting untill we can pay a normal price for one.

well, im srry, i cant figuer out the problem for now, i would if i had the full version
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Postby twobob » Mon Jan 09, 2006 10:44 am

Quick and dirty way:-
Create your text actor i.e text1 and choose the font and initial display in the text field i.e 0 (the number 0)
In your script, when you want to increase the score:-
Text1.textNumber = text1.textNumber + 10; // the value you want added
The position of where you have placed your text actor will show the score.


Another way to display a score is as follows:-
Create a global variable to hold and update the score throughout the game.
To create this global variable
Click on the ‘script’ menu bar at the top of Game Editor
Then click On ‘Global Code’
At the bottom of the screen click on ‘Variables’
Click on the add button
In the popup box type your variable name i.e ‘totalScore’
The next button down it should show integer, if not click it and choose integer.
(Integer is if you want to store whole numbers, real if you want to store numbers
like 3.47384 and string is if you want to store words i.e “My Cat”)
The next button down choose Global – With a global variable you can use this variable in any actors script.
In the next button down leave ‘Array’ to no and leave size blank.
Leave the ‘Save Group’ to blank for now– you can add to this latter in your game if you want to save the scores to a file when you next play the game.
At the bottom choose ‘Add’ then the button ‘close’

Next create a text actor
Add Actor – Type the name for this actor i.e text1
Click on text and choose your font and the initial text you want displayed i.e 0000, then click OK.

Make sure when the game first starts up you initialize the value of the global variable to 0; (totalscore = 0) You can do this in any actor on create actor, but make sure that it is an actor that is only created once throughout the game, otherwise you will be setting the global variable totalscore back to zero again when an actor is created again.

Throughout your game you can now update your global variable in any actors script
i.e totalscore = totalscore + 10;

When the game ends you can assign the value of your global variable to the actor text..
On the draw actor event in the actor displaying your picture put the following code in:-
text1.textNumber = totalscore;
You should now have the score showing where you have placed your text actor in the game.
Good Luck with the script - hope it works.
twobob
 
Posts: 33
Joined: Sat Sep 10, 2005 10:29 am
Location: England
Score: 2 Give a positive score

Postby Diana Kennedy » Tue Jan 10, 2006 2:29 am

Game a Gogo, I understand. Hope you will be able to own the full version soon. Thank you for the help provided!

twobob,

Well, THAT was really interesting. Exactly what I needed, a step-by-step guide. In fact, I already did the first quick-and-dirty version, it worked, I have a score displayed but could not make the result displayed by another actor. So I will try out your global code thing. Thanks also for explaining this so carefully, I can follow much better this way. I will try out this one and report the result! Thank you so very much for your time! 8) 8)
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Postby Diana Kennedy » Wed Jan 11, 2006 6:14 am

Twobob,

Well, it worked! Akltough I had the problem that the text1 actor displayed 0000 during all the game. So I worked wit both ways; A clssic score actor that counts during game and this text score that will only enter into game when it is finished.
User avatar
Diana Kennedy
 
Posts: 257
Joined: Wed Dec 07, 2005 12:34 am
Location: France, where Presidents who got shot in Texas do exile ;-)
Score: 0 Give a positive score

Next

Return to General

Who is online

Users browsing this forum: No registered users and 1 guest