Jump to content

vector2D to isometric


gamify
 Share

Recommended Posts

 this.patrol_addPoint( new me.Vector2d(100, 100));
          this.patrol_addPoint( new me.Vector2d(200, 100));
            this.patrol_addPoint( new me.Vector2d(200, 200));
            this.patrol_addPoint( new me.Vector2d(100, 200));

how can i convert moment of 2D to 'isometric sprite animation' movement .Please can anyone help??

Link to comment
Share on other sites

i am trying to move my sprite in isometric way but it is taking the orthogonal way 

 

i tried that is throwing error 

 me.Vector2d.toIso is not a constructor

 

tried using example : 

Add a point which a patrol has to go through

this.patrol_addPoint( new me.Vector2d(100, 100));
this.patrol_addPoint( new me.Vector2d(200, 100));
this.patrol_addPoint( new me.Vector2d(200, 200));
this.patrol_addPoint( new me.Vector2d(100, 200));

Set direction and looping

this.patrol_setInfinite(true) 
this.patrol_setReverse(true)

Start the patrol

this.patrol_walk();

For more detail see demo.

https://github.com/Kibo/melonjs-cookbook/tree/master/cookbook/patrol

 

 

Link to comment
Share on other sites

Movement will only follow the path that you define.

You should be able to get some visualization very easily by drawing the path with the canvas lineTo() and stroke() methods. When your path is drawn the way you expect it, then getting the entity to follow that path is a piece of cake.

Link to comment
Share on other sites

even after giving pos using me.input.pointer.pos.x & me.input.pointer.pos.y it is taking as diff position as orthogonal and i am sure it is taking orthogonal because example i have taken of orthogonal and converting to isometric

Explanation :

 instead of 100 passing some points retrieved from me.input.pos.x 

 this.patrol_addPoint( new me.Vector2d(100, 100));

instead of moving on me.input.pos.x it is taking orthogonal (x,y) position

 

Link to comment
Share on other sites

Did you completely miss obiot's message where he provided the answer to that question?

FWIW, there are no strict boundaries for sprites or entities. This is how we're able to allow the spaceman in the platformer example to fall into pits and restart the level; if the entity was clipped to the world boundaries, he wouldn't be able to fall into pits and it would be very weird. That's not to say you can't clip entities; melonJS just doesn't do that for you.

Link to comment
Share on other sites

Movement will only follow the path that you define.

You should be able to get some visualization very easily by drawing the path with the canvas lineTo() and stroke() methods. When your path is drawn the way you expect it, then getting the entity to follow that path is a piece of cake. 

can you suggest me example to do this 

Link to comment
Share on other sites

Not sure of the answer as I have yet to work on an isometric game, but for debugging it, I would see how the coordinates turn out for your addPoint calls, and compare them against the ones of the blue tile. It might be worth noting, that one needs to generally convert screen coordinates to world coordinates. http://melonjs.github.io/melonJS/docs/me.Viewport.html#localToWorld

Link to comment
Share on other sites

@gamify did you try drawing the path, and using the dev console to check what is going on ? At some point you have to experiment by yourself, and here we are just talking about drawing a line, and not some super advance game algorithm or stuff.

So either from the melonJS renderer :

https://melonjs.github.io/melonJS/docs/me.CanvasRenderer.html

or just using the standard canvas API :

https://www.w3schools.com/tags/canvas_lineto.asp

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...