Score not working

0 favourites
  • 8 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Ok so im back with yet another problem. I have made a score system. It has a varible that changes when my bullet hits "Sprite8" which is a wall. Every tick it sets "RAILScore" (random name) to the varible. ( varible is just called score)

    But when I try it in game it doesnt work! Here is a picture

    ibb.co/iBOGN7

    as always, thanks

  • First thing I notice this that this belongs in the C2 portion of the forum (this is C2 right?). Might need a move.

    Can you please post a pic of the full code there (without those obstructions)? I notice that sprite2 (your rail/laser I assume) is doing something every tick at the top but I can't make it out to see if that's part of the issue.I'd also like some clarification of what you mean by the score not working correctly. Is it adding too much to the score variable or not at all? Have you tested it in debug mode to see whether the issue is the score not adding correctly or whether it's the text object not displaying the score? Also, assuming the value is not changing at all, I'd check to make sure your rails are not on a layer with a parallax of 0,0 (I see the HUD layer there), as it won't actually hit your walls and update the score. Just a few ideas.

    EDIT: Is your text object not displayed on the screen at all? Because that may be a parallax issue.

  • * moved from C3 to C2 section as image is def from C2.

  • Ok so here is full picture. The things that were crossed out were healthbar / a cannon: ibb.co/kSVVh7

    Next, it was on a layer with a paralox of 0, 0. I removed it and put it on the same layer as everything else and its still not working.

    The problem was that the score was just 0 all the time. I checked in debug mode thing, and it didnt update there either. But the text was showing, it just says "Current Score : 0"

    The thing the cannon is doing every tick at the top is just tracking the player.

    And also I will start posting in the right place too.

  • Hey! In the new screenshot sprite 6 does not appear to be in the layout (but looks similar to sprite 4, which is there), so the score would not be updated because it is never struck by the laser. This is assuming that the objects on the right in your picture are for the same layout as your screenshot. To make things easier to keep track of, I'd name your sprites something unique so that they can't get confused with one another.

    Hope that fixes things!

  • Oh yeah! I had one black box for the bullet and one for the game over screen background! Thanks! Last thing, if I wanted to reset the score when it starts a new game, could I just use Set text to "Current Score 0" every time it clicks the start game button?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oh yeah! I had one black box for the bullet and one for the game over screen background! Thanks! Last thing, if I wanted to reset the score when it starts a new game, could I just use Set text to "Current Score 0" every time it clicks the start game button?

    For sure. Just set score to 0 on your main menu (assuming you will be directed there after your score page) at start of layout. That way the score works correctly when you begin your next game.

  • aaaaaand the file is broken and the project is gone... faaantastic...

    does Construct 2 have some sort of automatic backup system?

    EDIT: nevermind i fixed it

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