Score with sprites

For questions about using Classic.

Post » Thu Oct 06, 2011 12:11 am

Hello, I wanted to make a scoreboard using sprites maybe there are better ways to do it but I did it for learning purposes. please let me know how it works and how could I improve it.

here is a screen:



and here is the file:
http://dl.dropbox.com/u/44323540/SpriteScore.cap

the file contains comments on how it works
ericrevollo2011-10-06 00:23:51
B
4
G
1
Posts: 18
Reputation: 636

Post » Thu Oct 06, 2011 8:11 am

I can't open the CAP, because I am in my office.

I am just guessing in the dark and maybe it will help you =))

Do you have 3 sprites with 10 animationframes and 2 private variables?

If not ... that's the way I would do .. the animationframe (0, 1, 2, 3, etc) would be similar to the picture of the the digit. By pressing a button you will add the value to the variable and per code you say "If var = 0 set frame 0" or "if var = 9 set frame 9" ...

If it will be 10 or higher you can add "if var >=10 make -10 and add 1 to var of sprite Nr 2" and the same for the second sprite.

Hope that helped!

Best regards
B
17
S
4
G
4
Posts: 94
Reputation: 3,058

Post » Thu Oct 06, 2011 10:48 am

That's already a fine effort there, using the mid expression and of course functions like it should be.

However there are a few things to improve, like your use of different sprites for every digit of the score.

A pretty universal integration of sprite numbers (in this case it's to display damage) can be found in this blog article: We Construct Blog Forum rescue #004: Bitmap font damage
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Thu Oct 06, 2011 2:52 pm

Yeah mid's the way to go. I made an example that uses the @ expression, and maps the sprite frames that way.

textset.cap
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Oct 07, 2011 2:24 pm

thanks for the coments, actually at first I wanted to use loops but couldn't make it work. i'll be checking the examples
B
4
G
1
Posts: 18
Reputation: 636


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests