Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Help with CopperCube
how to show the exact value of a variable

lcm
Registered User
Quote
2022-07-21 16:18:04

i want to show the value on the screen.i've seen some ccp using this ,but i dont know the method


Guest
Guest
Quote
2022-07-21 17:48:48

Check out Sven's answer to this post:

https://www.ambiera.com/forum.ph...


lcm
Registered User
Quote
2022-07-23 16:23:12

Can you explain it?I cant get his words????.Thank you.


Guest
Guest
Quote
2022-07-23 16:47:12

"You can use 2D overlay to display any text or image.

----DECLARE VAR----
NEW3DSCENE1
SetOrChangeVariable
COINS=0

----UPDATE----
NEW3DSCENE1
EveryFewSecondsDoSomething 100ms
Change 2D OverlayText
COINS= $COINS$

-----COLLECT A COIN----
SetOrChangeVariable
COINS=COINS+1"

Insert a 2D overlay in your scene. On the root scene node (New 3d Scene1 or whatever you have called it) in a "Before first draw" behavior use the "Set or Change a Variable" action to make your variable (Coins = 0). Now put an "Every few secs do something" behavior on that same root scene node.Sven sets it 100ms. That's 1/10th a second. Add the "Change a 2d overlay text" action to it. Add your 2d overlay and type in "COINS = $Coins$". Note the dollar signs around the variable. You need them for the variable to change. Now to collect the coin you can just use the default CC cube and add a "When clicked on do something" behavior to it and add the action "Set or Change a Variable" and type in coins then choose the add (+) operation and the value of 1. When you click on the coin it should update the the overlay.

One thing I forgot: you need to have your 2d overlay set to "Draw text" and put something like 0 for the text.


lcm
Registered User
Quote
2022-07-24 16:19:50

You ve helped me a lot. Thanks very much!


lcm
Registered User
Quote
2022-07-24 16:26:40

Ha! I know why I cant realize it. I forgottto click "draw text".Hahaha...


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internation?l" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© 2020 Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact