obiot

Members
  • Content Count

    287
  • Joined

  • Last visited

  • Days Won

    4

obiot last won the day on July 19

obiot had the most liked content!

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

3844 profile views
  1. Hi, for the level not stretching or taking the entire screen, check the params you passed to the me.video.init() method, the `scaleMethod` is the one to specify with something like `flex` to match the desired effect (at least that's the one used in the tutorial, but there are other you can check as well, for Platformer I personally use `flex-width`) for the movement, maybe you can post here the code of your entity if you are sure you properly follow the tutorial, but else I would say to check again part 3 and make sure that you added the call to `this.body.update(dt);` good luck !
  2. based on the callback stack it's more like the image used for the font is undefined and therefore the width & height properties, how did you define the font object, and did you added both the json and image in the preloader asset list ?
  3. awesome, and indeed i's a way better "experience". else, since I noticed you are using the master branch, would you mind testing the WebGL2 renderer ? it has been added in the last 8.0 (be sure you also have the latest 8.0), it seems to be working for most things (the platformer example uses it as well now), but it's still disabled by default, you can just add "preferWebGL1 : false" to the video init parameters (don't worry it will fallback to WebGL1 if the device does not support WebGL2).
  4. wait I'm being stupid, in the response object you already have all you need, including the overlap magnitude : http://melonjs.github.io/melonJS/docs/me.collision.html#.ResponseObject plenty of things to play with anyway, let me know which one worked the best for your use
  5. just google it quickly and found this as well, probably more precise https://stackoverflow.com/questions/9324339/how-much-do-two-rectangles-overlap
  6. what I would do personally is to actually use the response object you get through the collision handle, it prevent checking for overlap every single frame in your code and since you get directly access to both colliding object you can also filter and only check if/when response.b is the player. Then finally I would actually just calculate the distance between both position to see how close they are which should give the level of overlap somehow. so something like that : onCollision : function (response) { if (response.b instanceof MyPlayerClass) { //probably better to use both bounding boxes, just simplifying here distance = response.b.pos.distance(response.a.pos); if (distance < response.b.width / 4) { // if the distance between b and a is smaller than a quarter // of the b box size, we can assume that 3/4 of b is overalping with a doSomething(); } } } I haven't tried this code, so maybe I'm missing something, but definitely how I would start. let me know if it helped !
  7. flicker actually takes an optional callback function as argument, so you can directly remove the child from there or do whatever else you need when the effect is over. also it's good practice to disable collision on that object at that point, you can do it using setCollisionMask (at least this is how I do it), but using your own variable also do the job see the example below for both : https://github.com/melonjs/melonJS/blob/master/examples/platformer/js/entities/enemies.js#L78-L102
  8. @Thuan see my answer in your post
  9. Hi, the first that comes to my mind would be to create your own me.LevelEntity object, either by extending the default one or even just create your own, after all the default one is just quite basic and just switch to the level specified : https://github.com/melonjs/melonJS/blob/master/src/entity/level_entity.js
  10. Hi, welcome ! Definitely I would rewrite this part as this is a series of imbricated if else where at the end if a key is pressed the updated and collision check is never call/done. if left keypressed else if right keypressed else if jump keypressed else update/collision and you only wants to return the returned value of the update function.
  11. fixed in the master branch (melonJS 8.0)
  12. obiot

    The COVID-19 Game

    Approved with some smart renaming 👍🥳
  13. obiot

    Cannot Find Folder!

    Hi, you can just create the lib folder yourself and you should be fine
  14. obiot

    The COVID-19 Game

    Im confused on why they are censoring anything related to covid-19, its the same on youtube
  15. obiot

    Device orientation

    Hi, have you tried other event like pointermove or pointerup ? http://melonjs.github.io/melonJS/docs/me.input.html#.registerPointerEvent but as i was saying earlier on both android version you don’t actually need the user permission (as per the test we did a few days ago), so you can directly enable motion detection and it should work right away.