how to (and best way) to make movement patterns?

Get help using Construct 2

Post » Fri Jun 14, 2013 3:40 am

Hello all!
What i'm trying to do is a way to build a level with objects arranged in specific patterns in relation to other objects or with some "formation" pattern by themselves.

To best clarify my intention see this quick video:

http://www.youtube.com/watch?v=HMTMNPyUcbw

It's a Arkanoid like game with many objects following different movement patterns, like circling around an object, or following a zigzag line.

Some movements and patterns are easy to do. Sine Behavior and Pin Behavior solves many of those patterns but some others seems hard to make.

The "line movement" with or without abstract form is a hard one for me.
Circular movements around another object feels like a Pin thing with parenting and rotations but sometimes it doesn't work as intended.

Anyway, if someone made similar movement patterns and know how to make them in a manageable, editable way. I will appreciate it.
(Also interested in how to best load those patterns, like using xml, or something like that)
B
31
S
4
G
4
Posts: 110
Reputation: 4,593

Post » Mon Jun 17, 2013 1:58 pm

I have to refloat this topic since i'm still struggling with a method to make "movement patterns" or "arrangements in custom shapes formations" and things like that.

More examples of what i try to do (do and do efficiently):
1) Move objects in an eight shape or spawn an "eight formation" of objetcs.

2) Move objects in some kind of curved line or zigzag line.

3) Move objects around another object following a rotating path around it. (Like orbiting around an object). This one is easy but i put it as an example of Movement Patterns.

Again the link of a game with a lot of this kind of movement patterns i want: http://www.youtube.com/watch?v=HMTMNPyUcbw

What make me dizzy is how to save those patterns in a efficient way.
Hard code them? Spawn objects with an array? Create an xml with each movement and call functions from this file?

Fixed formations is one thing, but movements following a figure kills me.
This feels like the way one should program "Bullet Hells".

I need some direction here   
B
31
S
4
G
4
Posts: 110
Reputation: 4,593

Post » Mon Jun 17, 2013 6:24 pm

I think those triangles in the top left and right will be using the sine behavior and the bullets using the bullet movement..

I guess you could start simple rather than create the whole thing at once.

Also the path finding will work for zigzagging I believe.
B
20
S
7
G
4
Posts: 322
Reputation: 4,521

Post » Mon Jun 17, 2013 6:41 pm

For most pattern movement you can do an equation.

Figure 8 for example:
set x = radius*cos(speed*time)+center_x
set y = radius/2*sin(2*speed*time)+center_y

For multiple objects on the same path add a instance variable and call it offset and give it the value from 0-360.
set x = radius*cos(speed*time+self.offset)+center_x
set y = radius/2*sin(2*speed*time+self.offset)+center_y

You can also replicate it with the two sine behaviors as well. One vertical and one horizontal. Just make the vertical period half the period of the horizontal. Most zig zag patterns can be done with one sine behavior and one bullet.
B
85
S
27
G
85
Posts: 5,070
Reputation: 57,874

Post » Tue Jun 18, 2013 1:37 pm

Thank for the replies!

So in the end it's all about formulas than hardcoded positions. I was talking with a friend about this (my friend is a programmer), but i ended up blowing his head off with performance issues.

I will try your equations @R0J0hound thanks for your help with this!
Playing with combinations of Physics and sine behavior i found that they don't play mean with each other as i expected. I will try to add bullet behavior to the mix. I didn't take it into account for some reason.

Let me see how it goes!

Thanks for helping me ;)
B
31
S
4
G
4
Posts: 110
Reputation: 4,593


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 9 guests