How do I make an object hover & follow my player?

Get help using Construct 2

Post » Fri Jul 03, 2015 1:59 am

Hi,
I want to create an object which should float or hover in the air close to my player. (e.g at the top of my player's head) I have been wondering how I will be able to achieve that. It would be really nice if you guys can help me achieve my goal here. Thank you
B
11
Posts: 27
Reputation: 448

Post » Fri Jul 03, 2015 5:07 am

In my Game digital mist in the Arcade, players have a drone following them about.

The concept I used is on player creation the drone gets created too and gets set with the UID of the player its tied too.

Every tick the moving angle is set towards its player X,Y - 150 (in my game representing the position above the player)

If the distance between player and drone is bigger then a certain distance, the drone moves towards the move angle.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,567

Post » Fri Jul 03, 2015 12:12 pm

I lerp its position to an offset of the player's position (like player. X-100, player.Y-20) then apply the sine behavior set to vertical to give a look of hovering.
B
103
S
38
G
19
Posts: 962
Reputation: 17,996

Post » Fri Jul 03, 2015 1:41 pm

C-7 wrote:I lerp its position to an offset of the player's position (like player. X-100, player.Y-20) then apply the sine behavior set to vertical to give a look of hovering.


I have set the position but dont know how to apply the sine behavior set to vertical. The drone is moving above the head and following my player but it's not hovering up & down. I have added the sine behavior to the drone but can you tell me how to setup the sine movement in event sheet?

Image

Basically, for test purposes, I want the flying bee to follow the chicken around in a hovering state.
B
11
Posts: 27
Reputation: 448

Post » Sun Jul 12, 2015 4:08 am

I know its against the rule to post again but I really want someone to help me with the last step.
B
11
Posts: 27
Reputation: 448

Post » Sun Jul 12, 2015 4:13 am

I don't think you need to set sine to vertical every tick.

Have it at the start of layout and set sine behavior enabled (Vertical) or something.
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
9
S
3
G
2
Posts: 194
Reputation: 1,713

Post » Sun Jul 12, 2015 7:45 am

Emperor Ing wrote:I don't think you need to set sine to vertical every tick.

Have it at the start of layout and set sine behavior enabled (Vertical) or something.


Thanks that kind of solved the hovering problem but now the bee (sprite4) isn't following sprite2 around the platform. I want sprite4 to follow and hover around sprite2. You can view the EventSheet I posted earlier for reference.
B
11
Posts: 27
Reputation: 448

Post » Sun Jul 12, 2015 7:49 am

Edit..

Ok..
Setting the position every tick will ofcourse overwrite the sine behaviour..

I guess adding an

-every tick
sprite4 move at angle(sprite4.x,sprite4.y,sprite2.x-100,sprite2.y-200)

might get better results

maybe adding an inverted system is between values condition to stop it when it's close enough
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Sun Jul 12, 2015 8:00 am

LittleStain wrote:Edit..

Ok..
Setting the position every tick will ofcourse overwrite the sine behaviour..

I guess adding an

-every tick
sprite4 move at angle(sprite4.x,sprite4.y,sprite2.x-100,sprite2.y-200)

might get better results

maybe adding an inverted system is between values condition to stop it when it's close enough


I cannot post links yet so please remove the space to access the working file. Can you show me how to make it work? Just want the bee to hoveraround and follow the chicke.

https:// www. dropbox.com/s/lmhcjvb5fhjr66n/ProjectOne.capx?dl=0
B
11
Posts: 27
Reputation: 448

Post » Sun Jul 12, 2015 8:07 am

ganich wrote:
LittleStain wrote:Edit..

Ok..
Setting the position every tick will ofcourse overwrite the sine behaviour..

I guess adding an

-every tick
sprite4 move at angle(sprite4.x,sprite4.y,sprite2.x-100,sprite2.y-200)

might get better results

maybe adding an inverted system is between values condition to stop it when it's close enough


I cannot post links yet so please remove the space to access the working file. Can you show me how to make it work? Just want the bee to hoveraround and follow the chicke.

https:// www. dropbox.com/s/lmhcjvb5fhjr66n/ProjectOne.capx?dl=0


Unfortunately your project is using the platform+ plugin which I don't have, so I'm unable to open it..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Next

Return to How do I....?

Who is online

Users browsing this forum: evillair, Rable and 8 guests