How do you make a sprite fall against another sprite

Get help using Construct 2

Post » Thu Aug 11, 2016 8:58 am

I want the sprite to fall against another sprite and aim it's falling direction against the player. The options you use for the bullet behavior to aim towards the player doesn't work since the sprite don't fall all the time if you use that. If you use the bullet behavior the sprite will not fall all the time. Using the set angle of gravity also doesn't make it fall all the time. The sprite should aim at the other sprite and always falling. Here is two images showing how i want the sprite to move and still aim at the other sprite and how i don't want it to move. Rigth is how i want it to work. Wrong is how i don't want it to work. How do you make it work?
https://s10.postimg.org/g47ing74p/Example_00000.png
https://s9.postimg.org/t5mle3dnz/Exampl ... _00000.png
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Aug 11, 2016 9:47 am

Using bullet behaviour should work fine?

If you set the angle towards the player, and set the speed to something like say, 400... it will fall if it's above the player.

If the problem you're having is that the falling thing goes back UP again after it goes below the player, you need to set conditions on the movement. If you only want the thing to move and aim at the player if it is above the player and not below, then make the condition something like;

[Compare Y position of falling.object -> is less than player.object]
--- Set angle to player.object
--- Set speed to 400

I guess you should draw a picture of how you want this to work in your game though, because I still don't really understand what you're trying to do.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499

Post » Thu Aug 11, 2016 10:40 am

SoldjahBoy wrote:Using bullet behaviour should work fine?

If you set the angle towards the player, and set the speed to something like say, 400... it will fall if it's above the player.

If the problem you're having is that the falling thing goes back UP again after it goes below the player, you need to set conditions on the movement. If you only want the thing to move and aim at the player if it is above the player and not below, then make the condition something like;

[Compare Y position of falling.object -> is less than player.object]
--- Set angle to player.object
--- Set speed to 400

I guess you should draw a picture of how you want this to work in your game though, because I still don't really understand what you're trying to do.

~Sol






The problem whit that is that if the sprite is above or on the same Y as the other sprite it won't aim anymore. Making the sprite only aim at the other sprites X would work. But i don't know how to write that expression. I know the expression for making the sprite aim at both the other sprites X and Y but not just X.
angle(Sprite.X,Sprite.Y,OtherSprite.X,OtherSprite.Y) is the rigth expression for aiming at both the sprites X and Y. You can use it in different ways to change the ways the sprites aims. For just making it aim at the other sprites X though, even if removing the Y parts of the expression seems rigth it doesn't work. So how do you write it rigth?
Last edited by Calfuso on Thu Aug 11, 2016 11:38 am, edited 1 time in total.
B
12
S
2
Posts: 267
Reputation: 1,344

Post » Thu Aug 11, 2016 10:56 am

For Y component you can do "self.y" - if I understand your problem I think that will work.

In which case you would do something like;
[if ABC]
--- set thing.x position = otherthing.x
--- set thing.y position = thing.y (or self.y)

If that doesn't work then can you draw a diagram of what you want to happen - and then I should be able to explain better, or make an example.

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to How do I....?

Who is online

Users browsing this forum: Klarner and 26 guests