How do I make a Textbox for a interactive character name

0 favourites
  • 7 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • Hi there,

    I've been working on a platform game with character selection, 10 levels, timer, point score etc.

    The only thing i can't seem to make is a textbox where you can put your own players name.

    I really would like this to work to make it more interactive with the player.

    When the player inserts the name it wil be used further on in te game (Story, highscore).

    I've also included a screenshot.

    Thanks in advance.

    Greetz,

    Ruerd

  • Just get the text in the textbox and set a variable (say playerName) to it. Whenever you want the player's name to show use this variable. If you want it to persist between sessions, use a Webstorage object.

  • Thanks.But I'm just not sure if I understand, could you make an example?

    Do i need to make a global variable or a Instance variable on the TextBox?

    And does the variable needs be a Number, Text or Boolean?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • RuerdVisser1991 here include this in your code

  • Here. Using Webstorage to make it persistent.

    [attachment=0:12smvpf5][/attachment:12smvpf5]

    This example only shows the textbox layout if name is not stored. You can reset the storage and refresh the page if you want to go back to the textbox layout.

  • Great! Thanks for the help!

  • Perfect, just what I need

    But one question now : how can we use this Name in the middle on a sentence during the game ?

    In a RPG for example, at the start we name our character "HERO" and then during the game if some people talk to us, for example : "hey HERO how are you?"

    thx

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