JohnJ's Forum Posts

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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Kyatric: thanks, many interesting information!

  • I thought that construct2 does not work with .capx files...

  • One Way Door - it's cool idea! this is a more abstract concept

  • Thank's! I do it! :) Now I have a weapon on any created object by behavior... But now I need to finish the behavior. Thank you for help!

    in case you can simplify things, here's what I got:

    var plugin = this.type.objtype.instances[0];
    var image_point = {
        x: plugin.getImagePoint(this.bullet_point, true),
        y: plugin.getImagePoint(this.bullet_point, false)
    }
    var new_bullet_inst = this.runtime.createInstance(
        this.runtime.types_by_index[2], 
        this.runtime.getLayerByNumber(this.bullet_layer), 
        image_point.x, 
        image_point.y
    );
    new_bullet_inst.angle = this.angle;
    new_bullet_inst.set_bbox_changed();
    

    I can't find a function for replace this.runtime.types_by_index[2] to this.runtime.getTypeByName('Bullet'). If I wanted to create this function, where should I do this? change the program files do not want to, as the upgrade version will be updated ...

    And what about properties types. I need a ept_keyb and ept_instance types :) Now I use float and text instead of it, but it is not usability...

    And... How can I require that my behavior can only be used for sprites or other plugins that have method "getImagePoint" at "edittime"?

  • Hello, I try create a behavior "Weapon".

    Now I can't create a Instance of bullet in my plugin.

    My actions:

    1. Create a bullet on project.

    2. Create a "tank" with weapon.

    3. Add my behavior "Weapon" to the "tank".

    4. On the "space" key down I make a shoot from weapon by bullet from step 1.

    But for it I must create a new bullet from my behavior script. I saw in Events sheet, that my "tank" as Sprite can use Spawn function for create new Instance Bullet. From script it looks terrible in my performance:

    this.type.objtype.plugin.acts.Spawn.call(
        this.type.objtype.instances[0], 
        this.runtime.types_by_index[2],
        this.runtime.getLayerByNumber(this.bullet_layer),
        1
    );

    And of course, it does not work. Causes an error somewhere in eventg.js, as shown by firebug:

    evinfo.current_event is null

    return evinfo.current_event.actions[evinfo.actindex];    eveng.js (line 1576)

    I think it should be way easier and more beautiful, but I have not found anywhere else.

    Help me, please.

    Raw current variant of plugin you can download from onlinedisk.ru/file/772010