scoreboard

0 favourites
  • 3 posts
  • to show the score in 1 textbox, I can use a global variable.

    To show 2 scores (create a scoreboard), I suppose I can't use 2 global variables so I created 2 distinct variables in 2 different objects and created an event, on collision, add 1 to textbox (variable name) and with event system, every click, set text to "& variable name" but this doesn't work. Putting & variable name outside the " " doesn't work either. how can I fix this? The goal is to create a scoreboard.

    dl.dropbox.com/u/26331535/test.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Why are you using a textbox to display text? It is used to enter text, for example to get player's name. Notice that you can click with the mouse inside the textboxes and they get focus so the player could change the score. I don't think that is what you want.

    Normally you'd use the Text plugin, which is in the same group as Sprite.

    Then if you want to display more than one value in the text object, do something like:

    Text.Text-> "Home: " & Score1 & NewLine & "Away: " & Score2

    Where Score1 and Score2 are global variables (although you could use two instance variables created on the text object, which would be referred to as Text.Score1 and Text.Score2.)

    I put these change in your project.

    While I don't think you'll be using them, I modified your textboxes since they had several problems. (They are hovering up in the sky for now.) The instance variables were type Text, so you couldn't add to them. This is what was giving you big problems, I think. I don't know why it wasn't generation an error. Something to look into. (EDIT: I checked and Add to for a string concatenates to the end of the string.) Anyway, I changed them to numbers and the addition works fine. Then to modify the text of the textbox you were doing strange things with the locations of the quotes relative to the variable names and the & (I think because you couldn't get anything to work.) Also you only need to set the font properties once, so I moved that to on start of layout, instead of every tick.

    Here is the modified project.

    TestScoreBoard.capx

    Looks like it will be a fun game.

  • thx!!

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