• Content count

  • Joined

  • Last visited

About obiot

  • Rank
    Advanced Member
  • Birthday July 20

Contact Methods

  • Website URL
  • Twitter

Profile Information

  • Gender
  • Location

Recent Profile Visitors

223 profile views
  1. you don't need a player, you just need any objects that actually returns true from their update method, so as soon as you add any NPC in your game it will refresh automatically. Same if you do add camera effect (fading and so).
  2. but in this case, it does not take in account the current gravity, which means that falling can be true if either you are falling (vel.y > 0), or jumping (vel.y <0) ?
  3. well ok, i guess i was confused by your request on how to clone and drag... anyway I put back my same answer with both way of achieving drag & drop, it's your time to play and experiment with it.
  4. is a private property, and you should not use it directly ! the proper way to add or remove child from a container ( is a container) is through the addChild and removeChild method : also as you will see, addChild expect an object inheriting from the base me.Renderable class. as for modifying the level definition, you should rather directly get the me.Layer object, as I was explaining before the following code for example, will returns you all the container TMX Layer object (actually returns an array of me.TMXLayer) : that you can manipulate through the getter/setter described in the documentation here :
  5. oh yeah that's a good question actually, i did not need it so far, but it's definitely a handy answer/info to have
  6. already discussed and covered here : i'm not sure why you open again a similar topic, and not rather comment on the previous one if you have further doubts ? as for the draggable object, as I was highlighting in the other thread, you can check the corresponding example here : , and its corresponding source code here :
  7. 3 differents ways : if you want to have access to the loaded json, you can use the getJSON method from the loader : if you want to have access to the parsed & interpreted map, you can use the level director: and finally if you want to have access to the currently "loaded" map, you can use the getChildByXXX method from the world container object : this will for example return you the instantiated layer : now the usage depends a bit of what you exactly want to do ? do you want to change the level definition before a level is loaded ? or do you want to modify the level "in-game" ?
  8. FYI, there is a WWW remake in melonJS : source code of the main player here :
  9. what do you mean from a database ? note sure it is then what you expect as an answer, but you can use me.loader.load() to manually load an asset :
  10. great ! and sure `onDestroyEvent` works too ! maybe I was overcomplicating things by using those events, but it gives more toys to play with in the future if you want :):):)
  11. to clarify the part on the event : there is no "predefined" level loaded callback in a screen object. game.HUD.DeathClock = me.Renderable.extend({ init: function(x, y) { // .. your code // subscribe to the level loaded event me.event.subscribe(me.event.LEVEL_LOADED, this.levelLoaded.bind(this)); }, // callback for when a level is loaded levelLoaded: function(levelName) { // reset or start the tween } couple of additional comments : - you probably also need to remove or pause the tween manually when you for example switch back to the title screen (if you have one) - you will also need to unsubscribe to this event when also switching back to the title screen or any other not "in-game" part, see
  12. for the persistent flag, you just need add the flag to your tween this.tween = new me.Tween(this).to({ remainingTime: 0, }, this.remainingTime * 1000).onComplete(() => { //throw "GG BRO";"die"); me.state.change( me.state.GAMEOVER ); }); this.tween.isPersistent = true; this.tween.start(); for the level_loaded, it's about subscribing to the event, see the doc link i put before, but I think that the persistent flag here should be enough to fix your issue
  13. Oh I see it now, the tween itself being added to the world container upon creation, it gets removed when you load a new level. setting it persistent as well should solve your issue, but it also means that the timer will take in account the level changing/loading time. To solve that (if bothering you) you can also pause the tween when changing and then use the level loaded event to resume if once the new one is loaded (or just save the timer value, and create a new tween if you do not want to make the tween persistent)
  14. what I would probably do is to register on the `LevelLoaded` event and reset/start the tween when the callback is triggered.
  15. you are definitely hitting one of the limitation of our renderer, and mostly because this is one of the use case we don't actually test.... the reason being that as written earlier by Jason, using only independent/separated bitmap for your map is just a bad idea... (performances-and-size wise, especially if you later target mobile devices) So i don't know why you choose to do it that way, but my recommendation would be to merge all these "big" assets together with the small ones into a tileset.