aligning an object toward the mouse

0 favourites
  • 10 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • hello everyone,

    i am making a game , in which an object has to be aligned with the mouse and move forward when clicked. (this might be a nooby question but i couldn't find out how to

  • Add the mouse object then use these actions under the appropriate conditions:

    Set angle toward Mouse.X, Mouse.Y

    and

    Move Forward 100*dt pixels.

  • thanks, (realized that it was a nooby question)

    how can you make an object randomly spawn inside the layout, i can do the timing but not the random position ?

    thanks.

  • Every X Seconds > System, Creat Object ??? on Layer N at random(X), random (Y)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Every X Seconds > System, Creat Object ??? on Layer N at random(X), random (Y)

    i have to type this ???

  • No, you use the EVENT SHEET EDITOR

    Click on ADD EVENT then the SYSTEM icon. At the bottom of the window that opens there's a TIME catagory. Double-click EVERY X SECONDS. Enter how often you want to spawn a new object (1.5 is one and a half seconds etc).

    After that click ADD ACTION next to the event you just added. Click the SYSTEM icon again and select CREATE OBJECT under GENERAL near the top. Then select the object you want to create and BOOM! you're done.

    If you want to create the object at random times you would use the random statement. Instead of typing 1.5 for example type

    random(0,2)

    That would get Construct to select a random number between 0 and 2 and spawn the object at that time instead. You can change the range to what you want (1,1.5) (2.5,5) ... and so on. I know you didn't ask for this last bit but I'm just telling you as an extra feature. ;)

    Good luck.

  • thank you so much and sorry for wasting your time,                                          

    i am a total n00b <img src="smileys/smiley29.gif" border="0" align="middle" /> <img src="smileys/smiley9.gif" border="0" align="middle" />

  • No problem, we were all there once ;)

  • by the way , i love your game (airscape)

  • by the way , i love your game (airscape)

    lol...don't we all.

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