frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

Replace component behavior

Just a new component that would spawn another object at its location while simultaneously destroying itself when it receives input. Can potentially use the same menu or functions as the spawner component only there is no need for the "X/Y" input, no "Spawn X/Spawn Y" options, just the "Type to spawn +" selector. You can do this already with position/spawn/destroy behaviors in unison much like how you can emit things using other means, but i believe in the same way the emit component saves time a single replace component would as well.
Tagged:

Comments

  • There is an emit behaviour

    With emit at 0 force you can do with only 2 behaviours.

    Emit > Destroy
  • I'd use spawn, but whatever
  • There is an emit behaviour

    With emit at 0 force you can do with only 2 behaviours.

    Emit > Destroy
    Emit for me seems to have a 32 pixel distance at which emitted objects initially spawn, sometimes it's like a radius around the entire thing, other times its only to the left. I've tried modifying the settings for collision, drag, movable, and so on but nothing really changes this 32 pixel distance, so I've never been able to use it to replace an object in same exact position, at least not without further work. If there's some way you prep the object so it can emit at the same position I'd be interested knowing how.
    I'd use spawn, but whatever
    I'm currently using spawn for just about everything, it does work fine, it's just the stack of other behaviors necessary to get positional data, spawn, and then destroy itself can quickly clog up space.
  • Hey @Wizardry - this is just the type of thing that Bundles are designed to handle. You can group any set of behaviors (e.g. get position, spawn, destroy) into a single bundle, then add it to your menu and treat it just like a single component block.

    Do this:

    1) Set up your behaviors as you described (get x/y, spawn, destroy)
    2) Click the select tool and select these new behaviors
    3) Click "Bundle" in the wheel menu that pops up
    4) Open the bundle and add an input
    5) Connect your new bundle input to trigger your spawn/destroy

    Optionally, you can add an output as well if you want to chain them together.

    I have several custom behaviors like this that I use.
  • edited April 3
    I've tried using bundles, but are they intended to be an isolated behavior workspace once you open them? I don't know how to add input from beyond the bundle which is why I haven't used them as intended, and copy-pasting the sections doesn't work well with positions being overlaid and having to drag pieces and rearrange everything (I use them for now as a mechanic to save and review portions of 'code' or solutions to problems I've had in case I need to refer to them in another object or even game). Usually I've needed them tied into existing things for various reasons like the single active proximity (closest) or the single active same-message trigger per object limitations, but with it existing in an isolated space I can't connect anything. I'll try it out though and see what I can make work.
  • Here's an example of what I mean: http://flowlab.io/game/view/861462

    Press space to replace the cat with a dog. You can add a bundle like this to your bundle menu for quick access - it's just as good as having a built-in component :)
  • edited April 5
    Oh, from WITHIN the bundle is where you find the "New Input" and "New Output" components to connect bundles with everything else. I always looked for the option outside the bundle when I tried it out. Thanks, this will even help the lag from having a million components displayed.

    Do you know if there's a way to remove saved bundles from the menu? When I try removing a bundle by spawning it and interacting with it (through the "Add to menu" option) it will first add a new entry, and then upon deselecting delete this new entry, but the original bundle remains in the menu.
  • click the bundle button in the menu and hold it - a menu will pop up with the option to delete it
Sign In or Register to comment.

flowlab.io

| make games in your browser
@ 2017 Flowlab.io, All rights reserved.

Contact us

Get In Touch