• Content count

  • Joined

  • Last visited

About Parasyte

  • Rank
    Advanced Member

Contact Methods

  • Twitter

Recent Profile Visitors

616 profile views
  1. Are you using the ImageLayer API directly, or is it created from a tile map? Are you setting the repeat property correctly? Are you setting or changing the layer size? If you're using the repeat property, you should not change the size, since they are mutually exclusive configurations... Logically, anyway. There's nothing wrong with using them together if you wanted that black bar! When using repeat, the image is sized to match the viewport (not the level). So this leads me to believe you're using the API in an unexpected way.
  2. WebGL has a soft requirement that textures width and height are a power of two, e.g. 128, 256, 512, 1024, ... And any combination is allowed; 128x1024, 512x256, etc. You should be able to accomplish your goal with a single background texture (just draw your gradients in Photoshop or whatever) that is wider than tall. You can also set the scrolling ratio to <1 so that it scrolls slower than the other tile layers in your map. For example, a ratio of 0.5 will cause the background to scroll at half the speed of the viewport.
  3. Just the source code/documentation: And how maxVel is used for clamping the total velocity:
  4. Just use cache busting. If you are loading the JSON through our loader module, you can set this flag to enable cache busting: me.loader.setNocache(true); For reloading the JSON often, just call that function before each reload. If you are using another method to load the JSON, like XmlHttpRequest, cache busting is just a matter of generating a random string and appending it to the URL query parameters.
  5. Wow, that's a whole lot of code. You know it would be easier to debug if you uploaded the project somewhere, so that it could be run in a browser. GitHub's collaboration tools are also incredibly useful for these kinds of requests, since patches can be easily submitted as pull requests, and applied at the click of a button. Anyway, this line is curious: You don't seem to set the max velocity anywhere explicitly, so that means it is set implicitly by the setVelocity call in the constructor: Given this constraint, it appears impossible to satisfy that first condition; the distance between the source and destination positions are very unlikely to be less than 1.8 pixels.
  6. You can resize the viewport to counter the scaling of its contents, but I don't think that's really supposed to be happening.
  7. The viewport inherits from the rectangle class, which has a scale method. Scaling the viewport only changes the virtualized size of the viewport. If you want to scale what is drawn, you have several options: Scale the viewport transformation matrix: Put everything into a container and scale the global transformation matrix prior to drawing the container hierarchy. Draw everything to an off-screen canvas, and draw it scaled to the screen canvas. The first option is the best option, and the one discussed in the linked thread.
  8. Chris, nice work! Thanks for sharing! I added it to our Made with melonJS catalog: Feel free to edit the description to something more appropriate, if you like.
  9. You can access the global viewport through The most you should have to do with the viewport is calling each time the target needs to change. E.g. if your player object is different between the two containers, just switch the follow target every time you switch containers. That should do it.
  10. You have to pass true as the second arg to removeChild. See documentation:
  11. You can pull the existing container out with, true) The second arg instructs the container to keep its children alive. As long as you have a reference held on `container` e.g. in the global namespace called "game", the container won't be GC'd. You can add it later with Use these methods together to swap containers.
  12. The z-index is the Z-coordinate in the 3D vector used for element positioning; this.pos.z
  13. I think you're "opening it" as if it was an application. Double-clicking on the .js file should really just open your favorite code editor with the file's contents. It sounds like you're double-clicking on it and Windows Script Host is trying to execute it, which is not at all what you want. Have you tried going through the tutorials? They describe step-by-step how to use the engine.
  14. Weird, the rawgit CDN doesn't support release links! I never noticed that. The is an archive containing the source code release. The build releases are one of these two: The first link is the compressed build, and the second one is the "debug" build. You can also use the boilerplate project, which contains everything you need to get started: And follow one of the tutorials to learn how to use it: Happy game dev'ing!
  15. I recommend adjusting the collision shape(s) on the entity body. If you only have one shape, it's very easy. // When `this` references a me.Entity var shape = this.body.getShape(0); shape.resize(shape.width, 200); this.body.updateBounds(); If you're not using the me.Entity class, then you can adjust the bounding rectangle directly. But as obiot pointed out, the bounding rect is just a cache, and melonJS will wipe it out on you. (So use me.Entity) // When `this` references a me.Sprite var shape = this.getBounds(); shape.resize(shape.width, 200);