Kill Counter

For questions about using Classic.

Post » Sun Nov 16, 2008 4:36 pm

I can`t get my kill counter to work tryed everything. I`ve made a new private variable called Score and then got always - Text: Set Text to ""Score: " & round(Character('score')) in events. Why don`t it work i`ve followed the tutorial from ghost shooter. I used to be able to get it to work but never been on consturct in ages so got it today and can`t manage to make it work anymore.

Thanks in advance.
B
2
G
5
Posts: 13
Reputation: 1,276

Post » Sun Nov 16, 2008 4:52 pm

Try making it always set text ="Score :" +(str(PlayerSprite.value('Killcount")))
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sun Nov 16, 2008 5:04 pm

Still don`t work. i will upload cap.

Download: http://files.filefront.com/Top+Down+Gun ... einfo.html

See if you can find what the problem is.

Thanks for fast replay.
B
2
G
5
Posts: 13
Reputation: 1,276

Post » Sun Nov 16, 2008 6:00 pm

You need to change it so that in event 3 when it destroys the AI it adds one to his score and it will work fine.

so
-Bullet overlaps AI
+ destroy AI
+Add one to player PV score
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Sun Nov 16, 2008 7:22 pm

[quote="Aeal5566":25li3yhu]Try making it always set text ="Score :" +(str(PlayerSprite.value('Killcount")))[/quote:25li3yhu]

That'd work to display the string, but is identical to the & syntax used in the original post. As Aeal said, with just the events you described you're showing a private variable that never changes, so you need to add 1 when you kill something :P
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Mon Nov 17, 2008 8:06 pm

Feel like such a noob i can programme in basic aswell so this should be easy to me lol. I have already added it though on event 3: Text Add 1 to "Score" and then got it displaying variable.

Pic:

Can you try explain more :P i`m such a noob lol.
B
2
G
5
Posts: 13
Reputation: 1,276

Post » Mon Nov 17, 2008 9:24 pm

Text: Add 1 to score

then later...

Character.Value('score')

You're adding to a 'Score' variable in the text object, but displaying the 'Character' score. Which one are you gonna use? :)
Scirra Founder
B
358
S
214
G
72
Posts: 22,946
Reputation: 178,333

Post » Mon Nov 17, 2008 10:50 pm

Before




After



The only thing I changed was the private variable in line 3. It adds to the Characters PV score and it will always display the current score in the text box. I hope this helps if not let me know if i can help any other way.
B
5
S
2
G
4
Posts: 632
Reputation: 2,829

Post » Tue Nov 18, 2008 2:26 pm

Thankyou so much for all your help and really quick replys.

I managed to get it to work with your help from both of you.

I can get on and do something else now make it more polished :p.
B
2
G
5
Posts: 13
Reputation: 1,276

Post » Fri Nov 28, 2008 6:18 am

I did this by adding a text file value.
First took the text and add a private variable to it.

then with the running time set text to 'variablename'

Example:
Event: Value 'hit count' equal to 5
Actions: Monster:Destroy
Text: Add 10 to 'score'
Text: Set text to 'score'

score means private variable in monster.

Thnkss and Good Luck
B
1
G
4
Posts: 1
Reputation: 1,027

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests