Asteroids-style momentum and turning controls?

Get help using Construct 2

Post » Mon Feb 06, 2012 8:05 am

For my first little project I just want to make an Asteroids clone. I'm using the Car behaviour at the moment, but it doesn't allow for rotation unless the object is accelerating (i.e., can't move in one direction, then spin and face the other way to fire behind you).

Any ideas?
B
5
Posts: 36
Reputation: 397

Post » Mon Feb 06, 2012 8:15 am

You should use the 8 direction behavior instead of car.

Fimbul also released a custom spaceship movement behavior a long time ago. It might be worse having a look at it.

Also check the wrap behavior (if you haven't already), it's a "classic" of asteroid's mechanics.
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 7,000
Reputation: 57,795

Post » Mon Feb 06, 2012 8:20 am

I'm using wrap right now. I tried fidgeting with the Car behaviour mechanics and got some degree of drift but it never felt right.
B
5
Posts: 36
Reputation: 397

Post » Mon Feb 06, 2012 10:55 am

The spaceship movement is probably what you need. Couple it with the wrap movement and you're gold.

If you run into any bugs with the behavior, report it in it's thread or PM me.Fimbul2012-02-06 10:56:20
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Mon Feb 06, 2012 11:02 am

What I would do is use no behavior, and do it manually. It is very simple, you do not even have to use vectors!

Instance variable: speed

Every tick: move speed*dt pixels at ship.angle

Every tick: set speed to self.speed * 0.something (if you want deceleration)

Is right arrow down: rotate clockwise -something*dt degrees
Is left arrow down: rotate clockwise something*dt degrees
Is up arrow down: add something*dt to speed.
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Mon Feb 06, 2012 11:43 am

[QUOTE=sqiddster] ...snip... [/QUOTE]
that won't work. You'll make instant turns.
You also won't be able to move in one direction while pointing at another (which is something the OP wants to achieve).
The only way out is to use vectors, or use my behavior which does that for you (plus it's faster, since it doesn't have to interpret events)Fimbul2012-02-06 11:44:27
B
35
S
8
G
8
Posts: 532
Reputation: 6,868


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests