0 Favourites

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

  • 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!

  • Construct 3

    Buy Construct 3

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

    Buy 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).

  • 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)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
[Plugin] tag text
188 25,459
RBuster's avatar
RBuster
Unread hot topic
99 10,159
karshinkoff's avatar
karshinkoff
Unread hot topic
167 14,518
DMT2005's avatar
DMT2005