Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
numbers
Old
fourbros
Senior Member
 
fourbros's Avatar
 
Status: Offline
Posts: 476
Join Date: Nov 2011
Location: Right Behind You...
Default numbers - 05-24-2012, 02:28 PM

How would you make an HP counter where the numbers increment and decrements on the screen? I am starting the battling part on my pokemon game and I don't know how to show how much Hp each pokemon has. Please help


My avatar is from the anime "Hyouka".......

You've probably never seen it, much less heard of it.....

You should watch it........


print("Hello World")
This is python code.

Lakers > Clippers
Vikings > Packers
Cardinals > Brewers/Pirates/Cubs/Reds
   
Reply With Quote
Old
arty-fishL
Senior Member
 
arty-fishL's Avatar
 
Status: Offline
Posts: 1,878
Join Date: Mar 2008
Location: In the corner of your eye
Default 05-24-2012, 03:29 PM

Its quite simple actually.

In Alice, add 3D text (at the end of the object gallery).
Position it very close to the camera and resize it to fit.
In its properties you can modify extrusion so it looks nice.
You may want to set its shading style to "none", so it is not affected by lighting levels. This will cause issues with colour, but you can use coloured texture images.

Then for its code, when HP is a global variable, you can add a "When a variable changes" event.
Have this event change the 3D text's text.
For the text, under world functions you will find "[what] as a string" and "int [a] as a string", you would want the event to look like this:
Code:
When (world.HP) changes, do ( [hp display text] set text to ( ( int (world.HP) as a string ) as a string) )
Notice that you need to insert the "int a as a string" into the "what as a string"

To codify this:
Code:
world.HP.onChange = {
    world.hpDisplay.setText(
        string( int( world.HP ) ) );
    }
If that helps explain it better.


█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█
█░░▓░░░░░░░▓░░░░░░░░░░░▓▓░░▓░░░░░░▓░░░▓░░░░█
█░▓░▓░▓▓▓░▓▓▓░▓░▓░░░░░░▓▒▒░░▒░░▓▓░▓▓▓░▓▒░░░█
█░▓▓▓▒▓▒▒▒░▓▒▒▓▓▓▒▓▓▓░▓▓▓░░▓░░░▓▒▒▓▒▓▒▓▒░░░█
█░▓▒▓▒▓▒░░░▓▓░░▒▓▒░▒▒▒░▓▒▒░▓▓░▓▓▒░▓▒▓▒▓▒░░░█
█░▓▒▓▒░▒░░░░▒▒▓▓▓▒░░░░▓▓▒░░░▒▒░▒▒░░▒░▒▓▓▓░░█
█░░▒░▒░░░░░░░░░▒▒▒░░░░░▒▒░░░░░░░░░░░░░░▒▒▒░█
█░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░█

I have mostly moved on from Alice, but may still respond to messages if important [-]
   
Reply With Quote
Old
fourbros
Senior Member
 
fourbros's Avatar
 
Status: Offline
Posts: 476
Join Date: Nov 2011
Location: Right Behind You...
Default 05-24-2012, 05:00 PM

thanks


My avatar is from the anime "Hyouka".......

You've probably never seen it, much less heard of it.....

You should watch it........


print("Hello World")
This is python code.

Lakers > Clippers
Vikings > Packers
Cardinals > Brewers/Pirates/Cubs/Reds
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.