How do I make a typing game with multiple targets in Construct 3?

0 favourites
  • 7 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • Hello,

    I want to make an educational game similar to https://zty.pe/ but I am new to Construct 3 and am having several problems. My game will be for grocery store PLUs and I want multiple enemies to move toward the player, with the player being able to shoot them by entering their specific codes.

    How do I get my player character to shoot only when the specific codes have been typed into the text box? Right now, I know how to get the player to fire if something specific is in the text box, but that does not work for my game.

    I'm afraid that my game idea may not work and I'll have to cut my losses and have only one enemy appear at a time.

  • You'll want to use a text object attached to your enemy sprite in a container.

    When you type, you'll be able to compare the player input to the contents of the text object to pick the matching text object. If that text object is in a container with the enemy sprite, the correct enemy will also be picked. From there you have the proper target picked and you can do whatever you want with it, including get its position or destroying it.

  • Don't be afraid that your game idea will not work. Your idea is entirely possible

    For starters, try something like:

    If PLU.text = InputTextBox.Text - > shoot PLU

  • You'll want to use a text object attached to your enemy sprite in a container.

    When you type, you'll be able to compare the player input to the contents of the text object to pick the matching text object. If that text object is in a container with the enemy sprite, the correct enemy will also be picked. From there you have the proper target picked and you can do whatever you want with it, including get its position or destroying it.

    I'm playing around with it and I don't think I have it quite right. So I make a New Text Object and make the text within it the code, then add it to the container of the specific enemy I want, but then how do I tie that to the Text Input Box?

    Another thing that I am trying to figure out is how to remove the text inside of the text input box after a bullet has been fired. Right now, it just shoots rapidly until it does not match the desired text.

  • Don't be afraid that your game idea will not work. Your idea is entirely possible

    For starters, try something like:

    If PLU.text = InputTextBox.Text - > shoot PLU

    I've tried this and I think I am slowly figuring it out. So if I made multiple enemies, would I make a separate text object for each specific enemy, or would I keep adding them to the initial Text Object?

    Also, how can I remove the text written in the text box after the correct code has been inputted? I tried messing around with it through an System then Event, but I could not figure it out.

  • I'm thinking of changing the player ship to a turret and trying to work with that and the text input. Is that a good idea or a waste of time?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > Don't be afraid that your game idea will not work. Your idea is entirely possible

    >

    > For starters, try something like:

    >

    > If PLU.text = InputTextBox.Text - > shoot PLU

    I've tried this and I think I am slowly figuring it out. So if I made multiple enemies, would I make a separate text object for each specific enemy, or would I keep adding them to the initial Text Object?

    Also, how can I remove the text written in the text box after the correct code has been inputted? I tried messing around with it through an System then Event, but I could not figure it out.

    Each Enemy would have their own TextObject. There are a few ways to do this. Here are two:

    1. Link an Enemy to their TextObject using instance variables and UIDS

    UIDs are like social security numbers for objects. They're automatically given out to objects when the game runs, and they don't change during gameplay. You can use them to get specific objects with "Pick By UID"

    You would do something like:

    On Enemy Created -> Create TextObject -> Set Enemy.TextBoxUID to TextBox.UID

    This creates a textbox, then sets a variable within the Enemy object to hold the TextBox's UID, so the textbox can be referenced later

    Search for "RTS Template" in the Construct 3 start page for an example of this

    2. The second option is to link an Enemy to their TextObject using the new Scene Graph feature. (Heirarchies)

    Search for "scene" in the start page and take a look at the examples

    To remove the text written, use TextObject > Set Text

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