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

For questions about using Classic.

Post » Mon Jun 08, 2009 9:06 pm

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?
B
4
G
3
Posts: 25
Reputation: 975

Post » Mon Jun 08, 2009 9:12 pm

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.
B
2
S
2
G
4
Posts: 171
Reputation: 1,792

Post » Mon Jun 08, 2009 9:28 pm

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.
Image Image
B
161
S
48
G
91
Posts: 7,359
Reputation: 67,273

Post » Mon Jun 08, 2009 9:29 pm

[code:3m4zjkm7]
+ 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.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Tue Jun 09, 2009 7:45 am

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!
B
4
G
3
Posts: 25
Reputation: 975


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests