# Help with sprite distortion/exponential speed

### » Tue Dec 09, 2008 11:11 pm

I guess this is not gonna sound very good being my first post in here and all, but oh well.

I'm making a "Starfield" game in Construct: The player will move in 8 directions avoiding a series of "stars" which move to outside of the screen as they embiggen in order to give a "Moving through a starfield" effect.

Now, I'm a little stuck in two little things:

1.- In order to make the stars move, I'm using the Bullet Behaviour. Now, what event I need to use in order to make the sprites bigger as they move farther away from the center?

2.- In order to give a better effect and a bit of a challenge, the bullet speed must be exponential. Is there a way to do this? (Ie: In the initial position, speed would be X. 10 pixels away, speed would be X*2. 15 away, X*4. 20 away, X*8 and so on)

Thanks beforehand.
B
1
G
4
Posts: 3
Reputation: 1,031

### » Tue Dec 09, 2008 11:17 pm

You might have the best results moving the stars with events - ie. using sin/cos to work out the position. I can't remember the exact math.

Still, you could probably fake it fairly well by
1) use Set Width/Set Height, and enter a formula involving the distance to the center eg. 0.1 * distance(.X, .Y, 320, 240) (assuming 320, 240 is the centre point where the star comes from). This means the width and height would increase by 1 pixel every 10 pixels it moved, for example.

2) again it's probably not the correct formula for true 3D movement, but you could try Always - set speed to current speed + 100 * TimeDelta, or something. The speed will then increase by 100 pixels per second every second.
Scirra Founder
B
363
S
216
G
75
Posts: 23,124
Reputation: 180,557

### » Tue Dec 09, 2008 11:29 pm

1) Excuse the noob question, but... Where can I find the Set Width/Set Height?

2) That's EXACTLY what I need, but "speed + 100 * timedelta" but Construct marks it as erroneous
B
1
G
4
Posts: 3
Reputation: 1,031

### » Tue Dec 09, 2008 11:38 pm

[quote="Pato2747":3ex2m0r7]1) Excuse the noob question, but... Where can I find the Set Width/Set Height?[/quote:3ex2m0r7]
They're actions in the Sprite object. If you don't know that, it sounds like you need to run through the Ghost Shooter tutorial in the Learn section.

[quote:3ex2m0r7]2) That's EXACTLY what I need, but "speed + 100 * timedelta" but Construct marks it as erroneous [/quote:3ex2m0r7]
The expression is 'pseudocode' - nobody on the forum knows your exact object names etc., so you'll generally just get an approxomation on here that you can't paste in. Use the object panel at the bottom of the parameters dialog to find the speed expression. It'll look something like: Sprite[Bullet].Speed
Scirra Founder
B
363
S
216
G
75
Posts: 23,124
Reputation: 180,557

### » Wed Dec 10, 2008 12:50 am

-snip-
B
1
G
4
Posts: 3
Reputation: 1,031