How do I display an instance variable?

0 favourites
  • 9 posts
From the Asset Store
Make a displayed number gradually increase or decrease, making an impression of a real-time counting.
  • I'm VERY recent to gamedev so I really don't know much. I was creating a game and in the game I created an instance variable for when I pick up a certain object. I was wondering if I can display how much of these items the player has picked up for the player. Also, do I need to have it as a number or a string to display it?

  • Create a Text object. Add "TextObject set text to Player.varName" action into the event where you change this variable. Or you can do it on every tick.

  • Thanks! That helped! :) When I collect the item it appears as "Player.ObjectCount" maybe because I listed it as a string? I'll try again.

  • I also was wondering how to create another scene to transition to once I reach a certain part of the map. It would be great if anyone could help with that!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When I collect the item it appears as "Player.ObjectCount" maybe because I listed it as a string?

    Appears where? Please post a screenshot of your event sheet.

    I also was wondering how to create another scene to transition to once I reach a certain part of the map.

    You can compare Player.X or Y to check when that certain part of the map is reached. Or add a sprite (it may be invisible) and use "Player on collision with FinishSprite -> System go to layout Level2"

    .

    These are very basic questions, I suggest you start by studying a few templates that are included with C3.

  • I was able to fix it. Thanks for the help!

  • Create a Text object. Add "TextObject set text to Player.varName" action into the event where you change this variable. Or you can do it on every tick.

    So i hit set text what do I put in it?

  • So i hit set text what do I put in it?

    Object name, followed by dot, followed by instance variable name.

    For example:

    Enemy.armor

  • > So i hit set text what do I put in it?

    Object name, followed by dot, followed by instance variable name.

    For example:

    Enemy.armor

    Ok, thanks for the help!

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