gamify Posted March 24, 2017 Share Posted March 24, 2017 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?? Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 24, 2017 Share Posted March 24, 2017 Can you clarify? It sounds like the vectors are defined in orthographic space and you want to convert them to isometric space, is that correct? We have some convenience methods for these conversions: vector2d.toIso() vector2d.to2d() Quote Link to comment Share on other sites More sharing options...
gamify Posted March 27, 2017 Author Share Posted March 27, 2017 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 Quote Link to comment Share on other sites More sharing options...
obiot Posted March 27, 2017 Share Posted March 27, 2017 toIso and to2d are class methods ! this.patrol_addPoint( (new me.Vector2d(100, 100)).toIso() ); Quote Link to comment Share on other sites More sharing options...
gamify Posted March 27, 2017 Author Share Posted March 27, 2017 thank you its working but its going outside the game world ??? Quote Link to comment Share on other sites More sharing options...
gamify Posted March 27, 2017 Author Share Posted March 27, 2017 please can anyone help on this sprite animation is going outside the isometric game world and movement is happening as orthogonal Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 28, 2017 Share Posted March 28, 2017 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. Quote Link to comment Share on other sites More sharing options...
gamify Posted March 28, 2017 Author Share Posted March 28, 2017 this.patrol_addPoint( new me.Vector2d(100, 100)); it should take isometric x=100,y=100 right it is going outside isometric i thought sprite is bounding outside the game Quote Link to comment Share on other sites More sharing options...
gamify Posted March 28, 2017 Author Share Posted March 28, 2017 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 Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 29, 2017 Share Posted March 29, 2017 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. Quote Link to comment Share on other sites More sharing options...
gamify Posted March 30, 2017 Author Share Posted March 30, 2017 okay thank you and i used .Iso() function yes moving in isometric but only movement position was (0,0) orthogonal instead of isometric(0,0) position . So i need isometric map cordinates(0,0) ??? Quote Link to comment Share on other sites More sharing options...
gamify Posted March 31, 2017 Author Share Posted March 31, 2017 Please can anyone help on this Quote Link to comment Share on other sites More sharing options...
gamify Posted March 31, 2017 Author Share Posted March 31, 2017 i tried giving collision border but it is not moving outside the world because of the collision wall but its stopped and moving in standing position Quote Link to comment Share on other sites More sharing options...
gamify Posted April 3, 2017 Author Share Posted April 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
agmcleod Posted April 3, 2017 Share Posted April 3, 2017 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 Quote Link to comment Share on other sites More sharing options...
gamify Posted April 4, 2017 Author Share Posted April 4, 2017 okay thank you i will try Quote Link to comment Share on other sites More sharing options...
gamify Posted April 4, 2017 Author Share Posted April 4, 2017 thank you now taking the position of me.input.pos.x and y Quote Link to comment Share on other sites More sharing options...
obiot Posted April 4, 2017 Share Posted April 4, 2017 @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 Quote Link to comment Share on other sites More sharing options...
gamify Posted April 4, 2017 Author Share Posted April 4, 2017 hmmm okay thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.