[Behavior] Spaceship Movement Behavior

Post your completed addons to share with the community

Post » Wed Aug 17, 2011 5:12 am

Hello guys! This is my first post here in the forums, and also my first behavior!

I'm coming from another game making software, but I must admit Construct 2 is really easy to pick up, so much that I'm already developing some stuff for it! I initially made this movement through C2 Events, but then decided to contribute to the community and create this, so you guys don't have to reinvent the wheel.

I'm really excited about C2, that's why I'm donating my free time to help it succeed, and I think creating stuff for it is the perfect way to make it more powerful and easy to use.

The Movement
This behavior is pretty much self-explanatory, it's the same movement as the classic game "Asteroids", but a bit more advanced.

The Known Bugs
Sometimes, if you select the "Stop" option when colliding with solids, you can rotate your ship to make it stuck into an object. I might fix this bug later when construct is a bit more advanced. For now, use the "bounce" option and set the speed to zero or code your own solution.

The Download
Download the behavior!

Please take your time to comment here and tell me what you think, and please don't mock my horrible, horrible code!

Updated (27/02/2012): Version 0.2:
  • New Feature: Custom Controls
Fimbul2012-02-28 03:37:42
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Wed Aug 17, 2011 5:35 am

First thing first, a bug preventing execution in runtime.js
[code]exps["TurnRate"][/code]

Corrected code:
[code]exps["TurnRate"] = function (ret)[/code]

* There is no valid icon for your behavior, that's a bit of a downside ^^
You have to put a valid 16X16 icon. That's really a plus and you could use a retro asteroid sprite.

* The parent sprite doesn't warp (even when I add the warp behavior before, or after spaceship). In my memories, the asteroid ship did warp :P
You might have to adapt the plugin so that warp might work with it.


Apart from these points, this is a good job and a nice addition to C2.
Keep them coming. Kyatric2011-08-17 06:14:45
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 » Wed Aug 17, 2011 6:29 am

[QUOTE=Kyatric] First thing first, a bug preventing execution in runtime.js
[code]exps["TurnRate"][/code][/QUOTE]Fixed, thanks.

[QUOTE=Kyatric]* There is no valid icon for your behavior, that's a bit of a downside ^^
You have to put a valid 16X16 icon. That's really a plus and you could use a retro asteroid sprite.[/QUOTE]This only happens with windows XP or below, however, I uploaded a fix, so the icon should appear properly on older systems.

[QUOTE=Kyatric]* The parent sprite doesn't warp (even when I add the warp behavior before, or after spaceship). In my memories, the asteroid ship did warp :P
You might have to adapt the plugin so that warp might work with it.[/QUOTE]
Apparently the window size must be the same as layout size, so it should wrap eventually.

[QUOTE=Kyatric]Apart from these points, this is a good job and a nice addition to C2.
Keep them coming. [/QUOTE]Another behavior is in the works already :)Fimbul2011-08-17 06:36:06
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Wed Aug 17, 2011 6:38 am

Warp issue is resolved, it was just that the layout was bigger than the rendering screen, without scrolling.
On a layer the same size of the rendering screen wraping works just fine.

Also icon fixed. It's nicer than the blank icon it displayed :)
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 » Wed Aug 17, 2011 9:02 am

Nice example. I'll pass however for the license; ("If you modify this plugin in whole or in part, you must also credit me")

Generally i credit people where credit is due, but enforcement on a "full modification" seems excessive to me. We all use and learn code from various places all over the internet throughout the years without such licenses. Crediting people is good thing to do, but should be voluntary imo (not done legally), then we see who are the authentic kind people who do give credit.

(ps. i'm also just getting started with C2, so i apologize if my comment is deemed offtopic)

B
6
S
1
G
2
Posts: 32
Reputation: 1,347

Post » Wed Aug 17, 2011 12:10 pm

If you've coded something and don't mind how it's used, I'd recommend a BSD license. Basically anyone can do anything with it, except claim credit for it. Also, if you modify a plugin "in whole", I don't think you can claim any credit for it - that's like writing a new plugin from scratch.

Watch out for r51, I'm afraid it introduces breaking changes for plugins and behaviors so read the changelog carefully when it's out!
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Wed Aug 17, 2011 7:47 pm

Modified the behavior once again:
Actions:
  • Reverse X Vector
  • Reverse Y Vector
Properties:
  • Reverse behavior when colliding with solids
Also, I changed the license to the more permissive "New BSD License".
Removed that "modified in whole" clause too, I agree it was unreasonable.
Link at the top is updated - though I'll probably update it again when r51 is out.

Note: If you have any problem with the new license, contact me through the forums!Fimbul2011-08-17 20:06:26
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Aug 23, 2011 1:41 am

Updated to work with r51. I guess I'm the first 3rd party extension compatible, how cool is that? :D
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Aug 23, 2011 2:58 am

I look forward to using this plugin.

However, i would like to point out this error whenever I try to use it, in both C2 50 and C2 51:



I tried what was in the link just now, on C2 51, btw.

I also tried it earlier on C2 50 and got the same error.EmperorIng3602011-08-23 02:59:17
B
19
S
3
G
2
Posts: 148
Reputation: 1,945

Post » Tue Aug 23, 2011 3:02 am

You're getting that error because this is not a plugin, it is a behavior. You should extract it to
\Construct 2\exporters\html5\behaviors\
instead of
\Construct 2\exporters\html5\plugins\

Also, you'll need to create a sprite object and then click "Add/edit" on the behaviors pane, then add this as a behavior.

sorry that it wasn't clear.
Fimbul2011-08-23 03:04:02
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Next

Return to Completed Addons

Who is online

Users browsing this forum: No registered users and 3 guests