Multi-Resolution Game Development With GameBuilder Studio Check it out!
NEW Version 0.9.7 has arrived! New Blazing Fast Particle Engine & More Game Actions. Check it out
Asteroid Template GBS - FIXED Score update all wrong
  • Hi

    Using the GBS Asteroid template...

    Why is that "nearly" every time an asteroid is destroyed, the score does not update unless you have destroyed about 10 Asteroids...

    And also at about destroying 9, the next score for some unknown reason, is resets back to 0.


    GOTO ScoreLabel ->Properties
    Delete Rule = BindScoreValues

    Add a New Global Property
    Goto Global->Properties and add a Property=CurrentScore, Type=Integer, Value=0  
    (we use this to hold values whilst the game is adding and destroying things)

    GOTO GunShip Missile Properties -> Rule ->Trigger Actions and delete everything ACCEPT  trigger = Destroy 

    Add 2 new Constraint properties to replace what was there (keep trigger=destroy)

    a) Increment_Global_Score : Trigger Actions

    Constraint Property = #Globals . Data . CurrentScore (no spaces)
    Type = Expression
    Empty Box = #Globals . Data . CurrentScore +1 (no spaces)

    b) Update_Score_Label  : Trigger Actions

    Constraint Property = #ScoreLabel.Renderer.text
    Type = Expression
    Empty Box = Globals.Data.CurrentScore

    Now it should be counting into the hundreds instead of 0-9...

    Not really got a clue... but the idea here is that I suspect object/entity/missile or Gunship "stuff" is getting destroyed before its values can be captured/recorded and used somewhere else.
    So we capture and store the data we might need later(Globally), away from the Objects like Asteroids, Missiles and Gunships, which have properties that are probably getting destroyed before data can be stored properly....
  • 2 Comments sorted by
  • Hi,
    I noticed that the display of Text is connected to the size of the "borders" in GBS (the 7 boxes around your entity which you can click on to resize it). In the Asteroid Demo you can just draw the borders a little to the right to prevent the effects you describe - which is the number getting bigger than its border and not being able to display fully (for some reasen numbers in GBS expand to the right, so if you reach 10, the 0 gets chopped off).

    The true problem is, that if you destroy and spawn a text entity, its borders seem to reset to the size of the text.render on spawn. So if you want to display numbers with several powers of ten, then make sure to fill the renderer initially with as many zeros (like: if you want to go up to 9999, set the value of the text.renderer to 0000 and implement a rule to set it to 0 or what starting value you like at spawn). At least that worked for me.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion