Stretch Sprite Between Objects

Get help using Construct 2

Post » Thu Feb 07, 2013 7:35 pm

Hi

I am trying to create a "tractor beam" style object.

I want one end of the sprite to stay pinned to another object while the other end will stretch and angle towards another object on touch.

I have managed to make the object angle towards my touch but not stretch.

I have tried setting the objects height to Touch.Y but this seems to work in inverse with the object getting smaller the further up the screen my touch is.

Thanks for any help!
B
3
Posts: 1
Reputation: 277

Post » Thu Feb 07, 2013 7:52 pm

Put the origin of the tractor beam on one end of the sprite. then pin it to the player object, then set the angle towards the target and set the width every tick to the distance between the 2.

also, make the tractor beam sprite a tiled background texture so that the texture doesn't stretch as well.

justifun2013-02-07 19:52:39
B
50
S
21
G
8
Posts: 844
Reputation: 10,299

Post » Thu Feb 07, 2013 9:13 pm

Another option is to use distance(ObjectA.X,ObjectA.Y,ObjectB.X,ObjectB.Y) when using set width for your "beam" object.

I am using tiled background instead of a sprite for tractor beam, but I think it should work with sprites as well if you setup your origin point correctly.

Edit: Now with .capx for proper tractor-beam action.
https://www.dropbox.com/s/t54zvcbp2faqvnw/Tractorbeam.capx

I actually might create a small game based on this mechanic.VonBednar2013-02-07 22:06:34
B
16
S
3
G
5
Posts: 44
Reputation: 3,231

Post » Fri Aug 09, 2013 5:46 pm

@VonBednar I couldn't get your capx working, it kept complaining about not being able to locate the Beam.png file.

So I made my own. Here it is, if anyone wants to have a look:
https://dl.dropboxusercontent.com/u/24767479/c2%20project%20files/Tractorbeam.capx
B
12
S
2
G
3
Posts: 86
Reputation: 2,955

Post » Wed Dec 11, 2013 10:28 pm

Hi, someone can tell me how stretch sprite between spriteA imagepoint1 and spriteB ?
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963


Return to How do I....?

Who is online

Users browsing this forum: Ahr Ech, Baidu [Spider], benajad, Braus, R0J0hound, shinkan and 17 guests