[Behavior] Zigzag

Forum Home Forum Home > Construct 2 Development > Plugins for Construct 2
 Post Reply Post Reply Page  123>
Author
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Topic: [Behavior] Zigzag
    Posted: 19 Nov 2011 at 12:51am
Zigzag
(icon is made by gonzdevour)
(Update: 2012/03/12)

Using LOGO-like script to move/rotate sprite.

Currently, zigzag provides 5 commands.
- Move (F)orward.
(ex: "F 100" means move the spsrite forward 100 pixels.)
- Move (B)ack
- Turn (L)eft
(ex: "L 60" means rotate the spsrite left 60 degrees.)
- Turn (R)ight
- (W)ait
(ex: "W 1" means do nothing, just wait 1 second.)
The format of one command is "F/B/L/R/W #".
ex: "F 100","B 100","L 60","R 60","W 0.5"

You can use a sequence of commands to describe the moving path. ";" is used to join commands. ex: "F 100;R 60"

Zigzag also provides repeat count setting. If repeat count = 0 means repeat infinity.

So combining command sting "F 100;R 60" with repeat infinity, you can image the sprite will move through a hex path repeatly.


Here is an example

- Zigzag uses as moving path of bullet


- Zigzag uses as moving path of platform object


Or, zigzag can be used to describe the moving path of an enemy, or the moving path of laser (combine with step behavior).



Basically, zigzag can wok well without adding any event.
It still has some conditions/actions.
- Condition: On command queue finish
- Condition: On command start
- Condition: On command finish
- Action: Set activated
- Action: Execution start
- Action: Execution stop
- Action: Clean command queue
- Action: Add command

The different between "Activated" and "Start" is --
"Activated" is more likely to "pause".



[Advance]
You can assign speed at command string by adding "[max,acc,dec]" after a command.
ex: "F 100 [200,0,0]; R 60; F 100 [100,0,0]; R 60"
- F 100 [200,0,0] -> using max speed =200, acc = 0, dec = 0 to execute command "F 100"
- F 100 [100,0,0] -> using max speed =100, acc = 0, dec = 0 to execute command "F 100"

The speed setting is used javascript's "eval" to get the array, so that you can use "[100+100*Math.random(),0,0]" to assign speed.




--
Yes, this is another plugin for lazy guy like me.

Edited by rexrainbow - 12 Feb 2013 at 4:39pm
Back to Top
6,626 Rep
Post Options Post Options   Quote tonycrew Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 1:38am
Thankyou for this.


P.S. I'm lazy too.....!

Edited by tonycrew - 19 Nov 2011 at 1:39am
http://dl.dropbox.com/u/44766364/Games/Space2011/index.html Space 2011 (C2 Competition Entry
http://dl.dropbox.com/u/44766364/Games/getin/index.html Get That Ball In (C2 Game)
Back to Top
1,390 Rep
Post Options Post Options   Quote EmperorIng360 Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 7:44am
You've made some pretty awesome contributions to C2, you know that? :D
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 8:24am
I'm glad that you like it.
Back to Top
7,746 Rep
Post Options Post Options   Quote Wink Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 8:37am
Thanks Rexrainbow this is just what I needed. This ones a great time saver.

I agree you do make some pretty awesome contributions. My Construct 2 plugins, and behaviors folders are full of rex_folders.
Back to Top
5,871 Rep
Post Options Post Options   Quote harrio Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 4:49pm
very nice sir,

you've pretty much automated enemy patrols for a lot of people.

well done.
Back to Top
2,668 Rep
Post Options Post Options   Quote Somebody Quote  Post ReplyReply Direct Link To This Post Posted: 19 Nov 2011 at 5:25pm
Oh, this looks like it could be quite useful for my current project. Well done, man!
Back to Top
2,171 Rep
Post Options Post Options   Quote jardelbr Quote  Post ReplyReply Direct Link To This Post Posted: 23 Jan 2012 at 3:53pm
Great !
One more time!
Lets Drink a beer to comemorate your presence here!

I love U man! Im reading all of your topics / posts of plugins / behaviors u made!

Thanks again!
Back to Top
10,425 Rep
Post Options Post Options   Quote rexrainbow Quote  Post ReplyReply Direct Link To This Post Posted: 25 Jan 2012 at 8:12am
@jardelbr

If you are using zigzag plugin to create laser, try to combine this plugin with step behavior.
Back to Top
2,171 Rep
Post Options Post Options   Quote jardelbr Quote  Post ReplyReply Direct Link To This Post Posted: 28 Jan 2012 at 12:55pm
@rexrainbow

Good. for now im not using lasers yet, maybe in future;

Thanks again.
Back to Top
 Post Reply Post Reply Page  123>

Forum Jump Forum Permissions View Drop Down