What does this mean? Capx attatched

0 favourites
  • 7 posts
From the Asset Store
Rotate & Animation for 16 Direction & Mouse Direction
  • Hello, I got this code from you tube. I have also seen it on here somewhere. Whats the point in it? The enemy seems to behave the same, even without this event.

    Also what is state? I know what Boolean and the number variable does. With state you can write in a box, but it dosent seem to do anything if I write idle or run ect?

    Thanks for the help.

  • The first action sets a variable called Dist to the distance between meleeninja and hero objects.

    The second action sets the animation to an instance variable on meleeninja to minimize code, i.e. when meleeninja is idle its state will be idle and play the animation "idle". The animations will be named the same as the possible states.

  • Well, obviously there is stuff missing there. You have to, I am guessing , change state depending on what the distance is, and you need to add these instance variables to this ninja sprite.

    This seems to be done in a different group of events.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Cheers plinkie/bad Mario.

    But why does that piece of code work. What and how is it doing exactly?

    Sorry to be a laymen. Also why is not player.x, player .y? Why player.x, player.x?

    Thanks

  • Cheers plinkie/bad Mario.

    But why does that piece of code work. What and how is it doing exactly?

    Sorry to be a laymen. Also why is not player.x, player .y? Why player.x, player.x?

    Thanks

    thats simple, because the distance measured there is for horizontal distance

    you can simply put distance(x1,0,x2,0) as well and would work the same, you can also put distance(x1,y1,x2,y2) but that would mean distance would count the difference of pixels from Y1 to Y2 also, so locking the Y1,Y2 to player.x does the same type of job as saying 0 or 1 or 2 or 100 to 100 which is 0., and only distance that is measured is the enemy.x, player.x the other variables don't count.

    distance(x1,y1,x2,y2) calculates the distance of position X1 to X2 and Y1 to Y2 if you lock any of those and say distance(x1,0,x2,0) then you would only get the distance from x1 to x2 if you lock the x1 and x2 then it will use the other variables.

    hope it makes sense.

  • Hi Bud,

    Thank you for explaining that. So it kinda of acts similar to a variable.I am dreading get into the math part of construct. But I am learning from you tube and you guys!

    Cheers corp!

  • Hi Bud,

    Thank you for explaining that. So it kinda of acts similar to a variable.I am dreading get into the math part of construct. But I am learning from you tube and you guys!

    Cheers corp!

    yes,no problem, for more information how distance is working check this bit distance formula

    it might have a different approach on Construct depends on how Ashley designed it, but in essence it should be the same.

    also, you remember that old annoying math teacher telling you "math is the key?" i didn't believe him either .... now im sorry xD struggling to remember what he teached ...

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