aligning an object toward the mouse

Get help using Construct 2

Post » Fri Oct 26, 2012 3:32 pm

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
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Fri Oct 26, 2012 5:30 pm

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.
B
79
S
24
G
52
Posts: 4,725
Reputation: 39,713

Post » Sat Oct 27, 2012 8:18 am

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.
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Sat Oct 27, 2012 12:57 pm

Every X Seconds > System, Creat Object ??? on Layer N at random(X), random (Y)emoaeden2012-10-27 12:58:20
Using R238 for all examples
B
60
S
17
G
6
Posts: 363
Reputation: 9,125

Post » Sat Oct 27, 2012 3:35 pm

[QUOTE=emoaeden] Every X Seconds > System, Creat Object ??? on Layer N at random(X), random (Y)[/QUOTE]

i have to type this ???
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Sat Oct 27, 2012 3:45 pm

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.
B
19
S
5
G
4
Posts: 208
Reputation: 3,960

Post » Sat Oct 27, 2012 5:20 pm

thank you so much and sorry for wasting your time,                                          
i am a total n00b
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Sat Oct 27, 2012 5:25 pm

No problem, we were all there once ;)
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat Oct 27, 2012 5:49 pm

by the way , i love your game (airscape)
B
20
S
8
G
2
Posts: 122
Reputation: 3,202

Post » Sun Oct 28, 2012 12:51 am

[QUOTE=ash1221] by the way , i love your game (airscape)[/QUOTE]

lol...don't we all.
B
50
S
17
G
15
Posts: 1,029
Reputation: 26,289

Next

Return to How do I....?

Who is online

Users browsing this forum: suicidenutella and 0 guests