Growler

Members
  • Content Count

    81
  • Joined

  • Last visited

1 Follower

About Growler

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. In MelonJS 5.1, after I load the level and the player entity, I set the player's position somewhere else (testing positioning) via: this.pos.x = 1000; this.pos.y = 1000; For some reason, melon fades the screen out to white, re-renders the entire environment (it seems), and the player entity doesn't appear. I also get error: Uncaught TypeError: Cannot read property 'flipX' of undefined Which is complaining at line this.renderable.flipX(...) So it would appear the renderable is removed from the player entity. Moreover, other screen entities also appear to be destroyed, as I have logs in each entity's onDestroyEvent. All entities appear to be destroyed on a simple positioning of the player entity. Update: I tested logging the renderable and body property objects on the player entity before and after setting the position. Before, the renderable and body are both defined correctly according to the docs. After, both renderable and body are both undefined, yet the entity class is still instantiated. Question: Why is the entity or entity's renderable removed and why does the screen fade out on a simple entity repositioning? Note: I do not have a player entity object directly added to the Tiled map. Instead, I have a "spawn entity" object where I place at the position of where the player entity should ultimately be instantiated at a certain point in the game. I also have alwaysUpdate = true on the player entity. @obiot
  2. @obiot separately (I know I should probably start a new thread), do you know how can I maintain order of Tiled Layers? As you can see from the tiled Layers image below, Player should always appear behind building overlap (since it's ordered below in Tiled) yet in game he appears in front. Secondly, if I have to manually change the layering, how I can get access to the tiled layers within melonJS code?
  3. @obiot I just don't have time to read thru changes I need to make from 5.1 to latest. I guess the WebGL "Texture cache overflow: 16 texture units available." error is pretty annoying but not sure any Melon upgrades can solve that limitation. (I talk about it here: If you email me at dan@scholarcade.com I can send you the game so you can check it out. Perhaps as you play maybe you can find some reasons I should upgrade?
  4. Hello, I wanted to use this particle creator/editor as I have many times before but it's down now: http://melonjs.github.io/melonJS/examples/particles/ Error throw in console is: Uncaught TypeError: context.beginPath is not a function Seems you've updated its MelonJS to latest without making necessary changes? I'm on Melon JS 5.1 and don't have plans to upgrade for the time being. Can you restore the functionality of this please? @obiot
  5. @PLAYERKILLERS What does sortOn "y" do? Can you elaborate a bit more on this answer and perhaps provide a couple examples?
  6. @obiot Hi Obiot. Wondering if you can help with this? Btw my game is ready if you're interested in trying it - please email me at dan@scholarcade.com
  7. Using Melon JS 5.1, I want to have an entity bounding box for collision, and a separate box for click interactions. Meaning, the smaller thin red rectangle is collision for the tree. If the player's Y coords are less than the tree's red collision rectangle, the tree appears behind the player. If the player's Y coords are greater than the tree's red collision rectangle, the tree appears in front of the player: Player in front: https://i.imgur.com/rDtjLeC.png Player behind: https://i.imgur.com/86QTdWs.png game.TreeEntity = game.MapObjects.extend({ /** * constructor */ init: function(x, y, settings) { // super constructor this._super(game.MapObjects, 'init', [x, y, settings]); this.body.removeShape(this.body.getShape(0)); // Divide height by 10 because we want the collision box to be basically flat this.body.addShape(new me.Rect(0, 0, settings.width/2, settings.height/6)); this.anchorPoint.set(0.5, -2); ... me.input.registerPointerEvent('pointerdown', this, (e) => { console.log('This is a ', this.type); }); I've tried adding a second shape to the Tree. The idea, again, you have a large area to click on the tree and get information about it. This new click rectangle is causing the original centered collision red rectangle to offset to the top left: Problematic offset larger shape: https://i.imgur.com/eOWfe9c.png // Clickable to get name this.body.addShape(new me.Rect(0, 0, 96, 192)); this.anchorPoint.set(0.5, 0.5); This is my desired end result: ------------------------- Moreover, the registered click event, registerPointerEvent, bound to this (the tree entity) only fires on clicking the smaller collision rectangle, not the larger shape intended for clicks. Questions: 1) how can I add a second clickable rectangle on the Tree entity that doesn't interfere with the current smaller red rectangle collision shape? 2) how can I specifically bind the registerPointerEvent to the larger clickable rectangle, not the smaller collision shape? 3) On hover, how can I change the coloring and/or opacity (to indicate that the tree is clickable) @obiot @Parasyte
  8. Using MelonJS 5.1 (I cannot upgrade at this point), I'm creating a fairly large adventure game. My TMX map loaded fine until I added water tile layer: https://i.imgur.com/i5kpTuc.png https://i.imgur.com/BzsxXTn.png At which point I started getting error: Texture cache overflow: 16 texture units available. Error name is me.video.Error Digging into the code, I see there is a max size for the Texture Cache: validate : function () { if (this.length >= this.max_size) { // TODO: Merge textures instead of throwing an exception throw new me.video.Error( "Texture cache overflow: " + this.max_size + " texture units available." ); } }, How can I fix this? Btw this seems to have been fixed in 2015: https://github.com/melonjs/melonJS/issues/595 @obiot @Parasyte
  9. Growler

    Entity glow

    @obiot @Parasyte any thoughts here?
  10. Growler

    Entity glow

    How can I glow me.Entity in MelonJS 5.1? For example, if I wanted to glow an entity on mouseover. @Parasyte @obiot
  11. I have a peculiar issue: if you accidentally hit tab in browser in game, it tabs to the URL bar as the next Browser element in line. What this means for MelonJS is if you were pressing a bound key, e.g., me.input.KEY.DOWN, at the time of tabbing, me.input.isKeyPressed('down') would remain true even if you're no longer pressing the key after focusing back on the game. 1) Why does this happen when you blur the game's focus? 2) How can I ensure isKeyPressed('down') is updated to current state onFocus into game? @obiot @Parasyte