[Behavior] moveto

  • For those who want to be able to debug the Moveto behavior, add the code copied from the box below at around line 215 of runtime.js... just before the comment that says "Conditions".

    [quote:1je44thx] this._moving_angle_info = o["ma"];

    this._last_tick = o["lt"];

    };

    ADD DEBUG CODE HERE

    //////////////////////////////////////

    // Conditions

    Copy and paste this debug code into runtime.js of the moveto behavior

    	/**BEGIN-PREVIEWONLY**/
    	behinstProto.getDebuggerValues = function (propsections)
    	{
    		propsections.push({
    			"title": this.type.name,
    			"properties": [
    				{"name": "Target X", "value": this.target["x"]},
    				{"name": "Target Y", "value": this.target["y"]},
    				{"name": "Current speed", "value": this.current_speed},
    				{"name": "Remaining distance", "value": this.remain_distance},
    				{"name": "Hit target", "value": this.is_hit_target, "readonly": true},
    			]
    		});
    	};
    		
    	behinstProto.onDebugValueEdited = function (header, name, value)
    	{
    		var a, s;
    		
    		switch (name) {
    		case "Target X": this.target["x"] = value; break;
    		case "Target Y": this.target["y"] = value; break;
    		case "Current speed": this.current_speed = value; break;
    		case "Remaining distance": this.remain_distance = value; break;
    		}
    	};
    	/**END-PREVIEWONLY**/[/code:1je44thx]
    
    This has not been fully tested (watch/edit), so use at your own risk.
  • necromaster

    Thanks, I had merged this code into my plugin and updated it.

  • Great!

    Thanks.

  • rexrainbow

    Rex, occasionally the trigger "On MoveTo HIT TARGET" is triggered even when the X,Y Position of the object is different from the target.

    (I'm using the latest MoveTo plugin you posted on 1st page & Construct r168)

    The screenshot and the capx to repro the bug is on attachment.

    Try to click Area A & B back and forth really quick several times to repro it, then check the console afterward

    btw, thanks again for this awesome plugin.

  • Update

    Fix bug found by Potato

    Potato

    Thanks, it really need to set the target position at a very special tick.

    The concept of triggering "On MoveTo HIT TARGET" is that -

    the moveTo behavior set the instance to target position, it means that this instance try to move from current position to target position.

    And the "On MoveTo HIT TARGET" will be triggered next tick since the instance has already at target position.

    If the target had been changed between these two ticks at event sheet, it will cause the bug. So I check the target position again before "On MoveTo HIT TARGET" triggered.

  • Thanks for fixing it rex, the update so far works great.

    You're the best

  • Nice behavior, thanks !

    I hope you will make behavior: ZoomTo or SizeTo on the same model

  • amkp

    Try tween behavior

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, i try it now. It's good!

  • rex_bCmdqueue - command queue

    For example, "action:set target XY" in moveTo behavior will set the target position by latest action. User could pend target position by this command queue behavior, to assign next target position while "condition: on hit target".

  • Where can i find the last update file?

    in the first page i can see (Update: 2013/05/02)...

    Thank's

  • Just look above your post at rexrainbow signature as he has a link called 'List of my plugins' which shows all of his creations, which includes the MoveTo plugin updated 26 April 2014.

  • rexrainbow your MoveTo is awesome. Do you think you can put a property like FPS...so it can move the object with a 30 frame rate ? Before I found your plugin I was using the Sprite.X+distance every X seconds...So i had more control on tweaking the performance.

  • Cipriux

    MoveTo moves instance by dt, it will be frame rate independently.

  • rexrainbow Yes, I understand that..but it would be nice not to move the object every frame is I choose too, but every 2nd or 3rd frame..I don't know how much improvement in performance will be especially for many objects on mobile

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