0 Favourites

hello Im about to ask a silly question (newbee).

This forum is currently in read-only mode.
  • I have been trying out this application for over a week ( like it a lot) and now I am trying to have ago at creating my own game (just a very simple tank move and shoot game). My question is this: I have given the players tank a private variable (health) a value of 100. When this tank gets shot by a computer controlled tank this variable decreases by ten etc until the tank is distroyed. My problem is I cant seem to get a text object to display the current value of the tank private variable. Im sure there is a way you could do this with python code, but is there a blinding obvious way you can do it with the on screen statements. I first thought i could use the "Set text" statement, but as far as i can see this will only allow you to enter text and not point to a private variable. Any ideas?

  • hi there!

    to answer your question, you can actually use an expression instead of just entering text; to get the value of a private variable from an object, you could use e.g. Sprite('variableName')

    but i would really like to recommend that you try some of the tutorials (link), which cover this and similar basic topics; they are immensely helpful in getting to know construct & the way it thinks, and usually don't steal too much of your time in the process.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Yes the Ghost shooter tut covers this. Btw python, is generally reserved for things that can't be done in events, and that list is very very short.

  • + Always
        > healthText:  Set text to playerTank.Value('health')
    [/code:3m4zjkm7]
    
    where "healthText" is whatever the name of your text object is and "playerTank" is whatever the name of your player object is.
    
    But yes, a tutorial is a good idea.
  • Hi everybody, many thanks (especially for the speedy reply). Just completed the ghost shooter tutorial, it has answered quite a few other questions I was going to ask, again thanks for you help!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
353 32,113
yojona's avatar
yojona
Unread sticky
192 1,337,490
Kyatric's avatar
Kyatric Construct Team Support
Unread hot topic
132 17,749
LordCrafterMC's avatar
LordCrafterMC