Array not working

0 favourites
  • 3 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi. I'm working on a childrens game, a little like Angry Birds, but the goal in my game is to help the fish get to freedom (i.e. the sea).

    I've worked on some solutions for shoving the score. The usual textfield showing the score with a system font is a bit boring, so I tried web-fonts which are nice, but not consistent in all browsers. Chrome seem to have some issues with webfonts I think.

    Anyway, I thought that maybe a simple system with 10 different bitmaps showing the numbers from 0 to 9 would do. I made an array to keep the four digits I need in place and made a test project just to see if I was on the right track. And the test project seem to do the job: Numbers test As you can see the number I put into the global variable "Score" is recreated and printed on screen as a nice row of numbers the way I want it to.

    So far so good. But when I try to implement this into my real game it just won't work. Here's the game code: Save the fish r132

    The function "ScoreNumbers" is called in the "EndOfLevel"-function in the EventsCore-sheet. You'll find it at the bottom of the sheet. As far as I can see the tokenat-expression doesn't find anything in the NumbersArray. But why not? I really hope somebody in this good community can help me! <img src="smileys/smiley18.gif" border="0" align="middle">

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • SigmundO

    First of all, your game looks nice ! I would love to see it finished :)

    Then, I got it to work quite simply. Your problem is a misuse of the function tokenAt. First parameter needs to be a string, and you give it a number. If you just add a "str()" around it, it works, like this :

    tokenat(str(Score), NumbersArray.Indeks, "")

  • Thank you!!! <img src="smileys/smiley4.gif" border="0" align="middle" /> Happy now I am! <img src="smileys/smiley36.gif" border="0" align="middle" />

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)