0 Favourites

[Behavior] Spaceship Movement Behavior

  • 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.

    <font size="3">The Movement</font>

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

    <font size="3">The Known Bugs</font>

    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.

    <font size="3">The Download</font>

    <font size="5">Download the behavior!</font>

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

    <font color="red">Updated (27/02/2012):</font> Version 0.2:

    • New Feature: Custom Controls
  • First thing first, a bug preventing execution in runtime.js

    exps["TurnRate"]

    Corrected code:

    exps["TurnRate"] = function (ret)

    * 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. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • First thing first, a bug preventing execution in runtime.js

    exps["TurnRate"]

    ixed, thanks.

    * 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.his only happens with windows XP or below, however, I uploaded a fix, so the icon should appear properly on older systems.

    * 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.

    Apparently the window size must be the same as layout size, so it should wrap eventually.

    Apart from these points, this is a good job and a nice addition to C2.

    Keep them coming. <img src="smileys/smiley4.gif" border="0" align="middle" />nother behavior is in the works already :)

  • 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 :)

  • 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)

  • 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!

  • 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!

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Updated to work with r51. I guess I'm the first 3rd party extension compatible, how cool is that? :D

  • 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:

    <img src="http://i417.photobucket.com/albums/pp257/Emperor_Phoenix/Construct%20Problems/C2pluginerror.jpg" border="0" />

    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.

  • You're getting that error because this is not a plugin, it is a behavior. You should extract it to

    \Construct 2\exporters\html5[b]behaviorsinstead of

    \Construct 2\exporters\html5[b]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.

  • no, I'm sorry- I confused myself, thinking that plugins were the same thing (since that's what everyone else has made for C2 so for :p)

    Now don't I feel silly.

  • Please do feel free to comment on what you thought of it and make suggestions :)

  • Oops, I did not s?? that this plugin has already made ??himself and exactly the same and called it "Spaceship" too! I based my behavior on behavior "car". Plugin by Fimbul better than mine, in my opinion, although it has bugs in response to "On solid collision"

  • Hi, I love the behavior. I am trying to set this so it can be controlled by WASD. I'm having trouble figuring out how to do that. Does anyone have any idea? Thank you.

  • Oops. Guess I forgot to keep up with the updates. I'll update this to work with custom control schemes.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)