on mouse click, create box with text from file

0 favourites
  • 6 posts
From the Asset Store
Fully commented source code/event sheet & sprites to create a space shooter game
  • Hi all! Been awhile!

    I want to know if it is possible to do something like this:

    On mouse click on an object

    • a text box pops up
    • in that text box, it reads from a specific portion of a given text file. let's use a txt file of the first four lines of The Wasteland (copy and paste into notepad or something):

    April is the cruellest month, breeding

    Lilacs out of the dead land, mixing

    Memory and desire, stirring

    Dull roots with spring rain.

    So there would be four objects/sprites, and on click, each one would call from the wasteland.txt file, a specific line from the poem and only that specific line.

    Could someone help me out with a description of how this could be done or a capx?

    Thank you!


  • b...bump? :(

  • Sorry, is this what you want?

    1. You want a four or more line of poem in a text file

    2. Then spawn four or more sprite each related to that specific line of poem.

    3. If the sprite is clicked, a textbox would be updated with the line associated with the sprite?

    Edit: Something like this?


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • omg! YES!

    I don't really understand how it works. Would you be able to comment that capx or leave another reply.

    example: I'm guessing wasteland.txt was in the project folder before being exported or saved as a single capx file?

    i'm trying to do something like this. where if the player clicks on the teapot it says one thing from the txt file (say, line 1) and if the player clicks on the plates underneath it says another (line 2). I can make invisible sprites for this.

    <img src="https://dl.dropboxusercontent.com/u/93047429/teapot.png" border="0" />

    omg. you're the best. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • I updated the capx with comments. But you might want to ignore that and check the one below...

    Now that I understand what you are trying to make, I guess that capx is not very useful in this case. I make another one which is more straightforward and easy.


    This one is sure easier to make and you can edit it in C2 instead of having to dwell with a text file. (it only has one event)

    You just need to set a instance variable to the hotspot sprite to any text you wanted...

  • Thank you for both! Yes you are right it is easier to make in C2, but the problem is the text I'm working with is extremely long : Tender Buttons by Gertrude Stein - so for example, a carafe, her first poem, is 3 paragraphs).


    That's why i was wondering if having a text file of the poems would have been easier, since i could just call a line, instead of having to have the whole poem be put in to c2 as a variable or a text object or whatever

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