Moving the object at an angle

Get help using Construct 2

Post » Sat May 26, 2012 10:37 am

Hey guys !

How do i make an object move or glide towards the cursor ? And how do i add forces which changes the angle when it is moving towards the cursor ?

Thanks in advance !
B
4
Posts: 6
Reputation: 537

Post » Sat May 26, 2012 11:52 am

here you go.
Is that what you're after? Keep in mind I didn't implement acceleration but that's pretty simple.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Sat May 26, 2012 12:56 pm

@squiddster Thanks a lot for building this but when i try to open it, it shows this




The r90 isn't the latest version ?
B
4
Posts: 6
Reputation: 537

Post » Sat May 26, 2012 1:55 pm

Make a instance variable (text) name it state for your obj

the event:
System - Compare two values
Parameters:
Distance(mouse.X, mouse.Y, obj.X, obj.Y)
>greater than
100

The Action for obj is:
Set value
Parameters:
instance variable State
value="Close"

You can make as many states as you like. Now make events for your states like this:

obj - compare instance variable
parameters:
instanse variable = State
Comparison = Equal to
Value = "Close"

Add a sub event

Every tick
Action: obj -> rotate toward position parameters:
Degrees = 5
x = mouse.X
y = mouse.y
Action: obj -> move forvard 3 px
My game Petrolhead Tactics is now on Steam Greenlight. I could not have done this without C2 ? Please rate, if you like!

Steam client already open: petrolheadtactics.com/steam
Web: petrolheadtactics.com/greenlight
B
19
S
4
G
4
Posts: 132
Reputation: 4,095

Post » Sat May 26, 2012 2:05 pm

[QUOTE=Vishaag] @squiddster Thanks a lot for building this but when i try to open it, it shows this


https://dl.dropbox.com/u/79020893/New%20project1/error.PNG

The r90 isn't the latest version ?[/QUOTE]

r90 is the latest stable version, r91 is a testing version.
You can download it here.KFC2012-05-26 14:05:31
B
33
S
12
G
7
Posts: 227
Reputation: 7,582

Post » Sat May 26, 2012 5:00 pm

@ Monumental Awesome ! :D thanks a lot !
@KFC Thank you
@ sqiddster what i wanted is something similar to paper toss ..that is, once when clicked the object should acquire the point of the cursor and move towards it . I think i can make modifications for that !
Thanks again.Vishaag2012-05-26 17:07:40
B
4
Posts: 6
Reputation: 537


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 0 guests