R0J0hound's Recent Forum Activity

  • You can't use lerp() to do acceleration. You have two options. One is to use a third party plugin like litetween to do the easing or you can do it with math.

    For the math route to do acceleration you need to keep track of the object's speed. Then using this formula to calculate the stopping distance:

    stoppingDistance = (speed^2)/(2*acceleration)

    You could do this:

    global number acceleration=100

    global number velocityX=0

    global number velocityY=0

    global number targetX=0

    global number targetY=0

    global number angleToTarget=0

    system: compare distance(sprite.x,sprite.y,targetX,targetY) > (distance(0,0,velocityX,velocityY)^2)/(2*acceleration)

    set angleToTarget to angle(sprite.x,sprite.y,targetX,targetY)

    add cos(angleToTarget )*acceleration*dt to velocityX

    add sin(angleToTarget )*acceleration*dt to velocityY

    Else

    set angleToTarget to angle(sprite.x,sprite.y,targetX,targetY)

    add cos(angleToTarget )*-acceleration*dt to velocityX

    add sin(angleToTarget )*-acceleration*dt to velocityY

    Every tick

    sprite: set position to (self.x+velocityX*dt, self.y+velocityY*dt)

  • I can't open your capx right now, but you could use the clamp() expression to set the menu's position when dragging and on drop.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That condition is working correctly. You're picking the nearest line and setting it's width to the distance between the player and a node. The issue is finder.node is updated a few frames later so the width calculation will be the same and every frame the next closest line is destroyed.

    To fix it you'll need to synchronize destroying lines when you change nodes. A simple way would be to give the lines a variable with it's node number, then in the "step=finder.noSteps" event add a sub-event that picks the line with the old node number and destroy it there.

  • You need to put those events as sub-events of the start of layout event. As it is now they will all be run every frame.

  • That "system compare" doesn't pick anything so all the frames will change if the first instance of sprite makes the condition true. To fix use "pick by comparison" instead or add a "for each sprite" above the compare.

  • MiniHulk

    That's interesting it pauses for a bit, no idea why it does that. The behavior actually has nothing in place to support save/load currently.

  • megatronx

    Here's another iteration that adds other units (moving and not) that can push each other around. They're all circles.

    https://www.dropbox.com/s/98xzy7n9jrri6 ... .capx?dl=0

    Tokinsom

    If you're interested the smooth motion around the corners is done by using voronoi region around the polygon. The light blue region is closest to an edge and dark blue to a corner. It then finds the distance and angle between the object and that point or edge of that region. With that it can calculate how far to move away if too close.

    https://www.dropbox.com/s/ethfdnbvqlfij ... n.png?dl=0

  • [quote:8pibyrav]Then you can use the UID to pick them, and the sprite.count-1 to determine the last one.

    sprite.UID=Sprite.count-1

    that will select the last one created.

    That will only work if Sprite is the only object type you have in your game. Using iid might work though.

  • Bug. It pastes it regardless right now.

  • megatronx

    Here's the capx changed in a different way. It still uses imagepoints, but as long as there is three or more, and the points define a convex shape it will work. For isometric you could position the points in a diamond shape.

    https://www.dropbox.com/s/xvn63ri2yw9ir ... .capx?dl=0

  • Here's a non-regex way to do it. It just loops through the input a character at a time. It's longer but I do find it more readable.

    https://dl.dropboxusercontent.com/u/542 ... parse.capx

  • Mahbub918

    You can do it with the "take snapshot" action. Just set the canvas size to the layout size, capture, then set the canvas size back to normal. There's probably some browser limits to how big you can make the canvas though.

    start of layout

    system: set canvas size to layoutWidth x layoutHeight

    system: Take snapshot of canvas

    system: on canvas snapshot

    browser: invoke download of canvassnapshot with filename "layout.png"

    system: set canvas size to 640 x 480

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound