obiot

Members
  • Content count

    98
  • Joined

  • Last visited

About obiot

  • Rank
    Advanced Member
  • Birthday July 20

Contact Methods

  • Website URL
    http://melonjs.org/
  • Twitter
    melonjs

Profile Information

  • Gender
    Male
  • Location
    Singapore

Recent Profile Visitors

439 profile views
  1. nothing is wrong with github, error 800A0404 is when attempting to execute a javascript file, which is obviously not the way of using it as explained later in this same thread....
  2. l but then choose the boilerplate data directory as destination folder.
  3. i just realised we actually never translate an entity position, what i mean is that anentity.pos vector is always in world coordinates, this is all managed through the container update and draw function that translate the whole world/container and display only the visible part. So it means that it should work by only using the 2d() function on the entity pos vector, to find back the original orthogonal position from the TMX file.
  4. Yeah there is a typo in my code : txm_pos instead of tmx_pos
  5. Did u tried the to2d() function (and not toIso() since their position on screen used the isometric coordinates) to convert back to orthogonal coordinates? (See my previous reply)
  6. worth noting that by default a container will use the auto-depth feature : http://melonjs.github.io/melonJS/docs/me.Container.html#autoDepth so unless an additional z argument is specified, it will ignore the z property of the child position vector : https://github.com/melonjs/melonJS/blob/master/src/renderable/container.js#L145-L150 but then once an child added, you can just modify the object pos.z value as you wish, it will automatically be taken in account
  7. if you want to change the collision box but NOT the image, the only way i see is to resize it by yourself. You can get a reference to it by using the getBounds() method, then you have access to a me.Rect object that you can resize as you wish. However be aware that as soon as you apply any transformation to your sprite, melonJS will recalculate the sprite bounds and therefore ignore your changes. If you need a larger collision area for a sprite object, I would either more recommend to also add a transparent border to your sprite, or use an Entity object !
  8. you should rather use the viewport localToWorld and worldToLocal when switching from world coordinates to screen or the opposite : https://github.com/melonjs/melonJS/blob/master/src/renderable/viewport.js#L467-L497 So to find back the original position from the TMX it should rather be something like : console.log('pos:', this.pos.x, this.pos.y); // switch back to world coordinates var txm_pos = me.game.viewport.localToWorld(this.pos.x, this.pos.y); // switch back to orthogonal coordinates tmx_pos.to2d(); console.log('tmx_pos:', tmx_pos.x, tmx_pos.y); (you can also chain the method to make it shorter)
  9. if you would check the documentation, you would realize that the setColor function only take as input a me.Color object or a CSS string, so you should use either : renderer.setColor(myColor); // where myColor is an instance of me.Color or renderer.setColor("#0000007F"); // the forth byte (7F) is to specify the opacity level http://melonjs.github.io/melonJS/docs/index.html
  10. indeed, the worldToLocal() method is definitely one of your friend here to convert to screen coordinates.
  11. in the UI Example, that's exactly what we do : we use a container, but then we have a child renderable that we use for the background (i personally find it cleaner that overriding the draw method). It is a sprite object in this case, but you could use a renderable and using the renderer (arguments from the draw method) to draw it, add opacity, etc... as explained by Aaron. https://github.com/melonjs/melonJS/blob/master/examples/UI/js/entities/UIContainer.js
  12. we have a wiki page that we maintain on this purpose : https://github.com/melonjs/melonJS/wiki/Upgrade-Guide also, there is some good upgrade guide made by Cian Games (unfortunaly they stop at version 2.x though) : http://blog.ciangames.com/2014/08/upgrading-to-melonjs-10.html http://blog.ciangames.com/2014/09/upgrading-to-melonjs-11.html http://blog.ciangames.com/2014/11/upgrading-to-melonjs-20.html http://blog.ciangames.com/2015/05/upgrading-to-melonjs-21.html and generally speaking I would definitely check our wiki page, as it contains tons of informations and how-to on various topics (especially the 3rd-party tools section) : https://github.com/melonjs/melonJS/wiki
  13. @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
  14. using Texture Packer : https://www.codeandweb.com/texturepacker Tutorial here : https://www.codeandweb.com/texturepacker/tutorials/using-sprite-sheets-with-melonjs-tutorial which translates to this in the UI example : https://github.com/melonjs/melonJS/blob/master/examples/UI/js/game.js#L23-L28 https://github.com/melonjs/melonJS/blob/master/examples/UI/js/entities/UIContainer.js#L28 https://github.com/melonjs/melonJS/blob/master/examples/UI/js/entities/buttons.js#L21