• Content count

  • Joined

  • Last visited

About Parasyte

  • Rank
    Advanced Member
  • Birthday

Contact Methods

  • Twitter

Recent Profile Visitors

165 profile views
  1. (I know this is an old thread, but ...) I wanted to mention that the rendering bug you are seeing is an artifact that probably (?) doesn't show up in the WebGL renderer. I suspect it's caused by scaling, even the auto-scale feature would explain it.
  2. I mentioned that the reference to the global viewport is available through a few days ago: The documentation is comprehensive, which can make it a bit challenging for new developers to grok. The best tips I have are to read the forum replies very closely, and if there is something that you are not fully clear on, it's OK to ask for clarification. The second tip is looking through source code. Mountains and mountains of source code! You might find some useful snippet in the examples, or in a game someone else made. The best source of information though, is the melonJS source itself. The directory structure and layout is pretty much like what you see in the documentation, and the documentation even gives you file names and line numbers in the source code, if there is anything you are particularly interested in. One final tip; clone the repository and use local search tools to find interesting things. See attached for an example that would have showed you how to find the global viewport reference.
  3. The target map ("temp" in your example code) needs something to animate (or use the camera effects to fade). Same things mentioned above. Also your commented code is missing the point of the me.state.transition() method; this is for global configuration. You still have to enable the effect with me.state.setTransition(). And both of these should be called at boot up, not before loading a level. It also doesn't work across level loads, only across state transitions (as the name implies). Here's an example of implementing fade for level loading:"#FFFFFF", 250, function () { me.levelDirector.loadLevel("temp", { "onLoaded" : function () {"#FFFFFF", 250); } }); });
  4. This sounds like maybe a pointer event ordering thing? By default, pointer events trigger on objects "top-down". So if you have an entity that is above a background layer, the entity will receive the pointer event first, and can choose whether that event propagates to entities and layers below it. The event propagation model is similar to the capture phase in W3C events. If you want to prevent propagation, your event handler just needs to return false.
  5. Weird! I must have been building the wrong version, or looking at the wrong lines. The boilerplate is definitely on 4.1.0. Ok, last question. How are you adding the laser class to the entity pool? The tutorial shows this: me.pool.register("laser", game.Laser); It appears that the call in player.js to me.pool.pull("laser", ...) is instantiating a me.Entity directly, instead of instantiating your game.Laser class. Just going entirely on the stack trace in your first post.
  6. Do you have any objects on the map that do idle animations? This is the recommended solution; keep the renderer busy. A fade will be suitable as well. Just read the docs; the global viewport is accessible from Otherwise you can always put a call to inside the onLoaded callback. See also the LEVEL_LOADED event.
  7. Please clarify what you mean by "select". If you want something like this, you have to build it with pointer events, state management, and drawing your own selection rings.
  8. Something like this ... Define a globally-accessible boolean property: Feature-gate your entity updates on the value of the boolean: Alternatively, you could use me.state.pause() and allow only your modal popup to accept inputs with this boolean.
  9. What version of melonJS are you using? I couldn't find any recent releases that lined up with the stack trace you provided. The current version is 4.1.0
  10. Yeah ... It should respect the direction of gravity. The change you made will prevent the jumping flag from ever being true. Anyway, I'm glad you found something that seems to work for you. To fix the ceiling/floor resets, there is a second set of things to edit in the collision handler. This one is buried in the melonJS source code, though. It's mentioned in the ticket. And the animation weirdness is caused by the conditions you chose for swapping to your jump animation.
  11. In addition, use and friends to lookup the instantiated layers and game objects. When adding a child to the game world, make sure it is an instance of a class, and a not just a reference to the class itself. E.g. you need to use the new operator to create a new instance of the entity. There are many examples of this pattern, like the platformer tutorial, you'll find the following snippet: // add our HUD to the game world this.HUD = new game.HUD.Container();; An alternative is using the entity pool, which can help eliminate GC pauses by reusing instances. This snippet is from the Space Invaders tutorial:"player"), 1);"enemy", 50, 50), 2);
  12. What does your "laser" class look like? If you copied from the tutorial directly, did you accidentally leave off the width and height properties? See the end of the code snippet for `game.Laser`:
  13. "Dragging" is something that has to be implemented on the entity/sprite/renderable class. You are creating a `me.Sprite` instance, which does not implement dragging or any pointer event handlers. You can use me.DraggableEntity instead, or subclass me.Sprite to support drag events.
  14. Yes, it is possible. I assume your real question is how to implement double-click? You've probably noticed that melonJS only supports the PointerEvent spec, which itself does not specify gestures like double-click, pinch, or swipe. You can build your own by introducing a delay in the pointerup handler; set a timeout, then wait for one of the following events to occur: If a pointerdown event is received while waiting, this event needs to be promoted to a double-click event and triggered immediately. If the timeout expires first, trigger a single-click event immediately. The delay is configurable by the host operating system, it is usually about 300ms. We don't have any way of querying the UA to get any information about gesture settings. That said, I found the same question asked on the Babylon forum:
  15. It's undocumented, but you can use obiot's suggestion like this: me.loader.load({ "name" : "myLevel", "type" : "tmx", "data" : JSON.parse(mapSourceFromDB) });