How do I create text at mouse when an object is clicked

0 favourites
  • 3 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Hey there,

    I am making my first game which is a cookie clicker clone. I was using game maker studio up until tonight but think construct 2 may be a better choice for me going forward.

    However I can't seem to figure this out.

    What I am trying to do is when you click on the cookie object text will float from the mouse x,y position upwards for a second and disappear.

    In GMS I could do this via the GML language but I do not know where to start as I see no way of adding scripted events to a Construct game though I am sure there is a way.

    Hopefully someone can point me in the right direction.

    EDIT

    Just to give you guys an idea of what I mean. in GMS I could create an object and add a scripted event such as:

    speed = 1; // set the speed of the objects movement

    direction =90; // set the direction of the object. In this case 90 degrees (up)

    create_text(mouse.x,mouse.y,"text here"); // create text here at mouse x and y

    speed *= .9; // slows the text down every tick until it stops

    Then after x ticks destroy the object.

    I would then create this object on the right click event on the cookie object. thus creating the text at the mouse location.

    I could do this in javascript as well pretty easily however I do not know how to "inject" javascript into the game. It all seems very drag and drop only with construct. Hopefully I am wrong though!

  • there's a number of ways to do it. but here's one off the top of my head..

    you could give the text bullet behavior and fade behavior, then make a Mouse Event-> on object clicked (your text object) enable bullet (you have to also set angle of motion to whatever direction you want the text to go..(0-360 degrees)and click 'Set Angle' to Off in the properties panel). and also enable Start Fade. and in the Properties Panel of the fade just set fade out to 1.. (and destroy after fade for a nice clean up).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • there's a number of ways to do it. but here's one off the top of my head..

    you could give the text bullet behavior and fade behavior, then make a Mouse Event-> on object clicked (your text object) enable bullet (you have to also set angle of motion to whatever direction you want the text to go..(0-360 degrees)and click 'Set Angle' to Off in the properties panel). and also enable Start Fade. and in the Properties Panel of the fade just set fade out to 1.. (and destroy after fade for a nice clean up).

    Thank you. Following your advice I got it working.

    For anyone who needs to know how it is done in the future this is my events:

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