Jump to content

neils

Members
  • Content Count

    9
  • Joined

  • Last visited

  1. neils

    Animated tiles

    I managed to make some animated tiles in Tiled. They're nicely animated there. Now if I load the map in my game, the tiles are just still images. Question: is there anything I must do to get them moving or this should happen automatically? The only thing I found in the docs is the isAnimated property of the TMX layer, which is true in my case. Thanks
  2. I managed to solve this. The reason why things slide down on slopes is that on every collision they're moved outside the collision bounds, then they fall down a little bit, then again collide, etc... in a loop... which is I guess OK for most of the games but I wanted it to be different. So I solved it by bypassing the default respondToCollision function call and implemented a slightly different variant: onCollision : function (response, other) { // Slopes are marked "Slope" type in Tiled if(other.type === "Slope") { var overlap = response.overlapV;
  3. Seems like it's an older issue: https://github.com/melonjs/boilerplate/issues/34
  4. If I set friction to (1, 1) then the body stops sliding but the character can't walk at all 🙂 Any value lower than (1, 1) makes the body slide down (although very slowly). I think I will have to adjust the physics parameters dynamically. Detect if there's collision with a slope and add some extra force to keep the body in position. However calculating that force will not be easy.
  5. I managed to make the character walk uphill with normal speed by setting a low body mass. But I still have problem with sliding down on slopes. The character is now sliding down very slowly (I guess because of the low mass) but I can't figure out how I could prevent it from sliding.
  6. Please take a look at the attached screen recording. The two interesting hitboxes are the main character and the platform. The platform is an object drawn in the "collision" layer in Tiled according to the instructions the platformer tutorial. I can't figure out why the following things happen: 1. Why does the main character's hitbox leave the sprite? It moves faster to the right when the screen is scrolling. 2. Why is the platform fixed on the screen? Shouldn't it be scrolling like the other layers? What makes this layer fixed? Here is the code for the PlayerEntity which shows
  7. I'm somewhat extending the platformer tutorial and trying to write a new game. My problem is that if I draw platform objects in the collision layer that are not completely flat but a diagonal slope for example, the character moves very slowly uphill and slides fast downhill. Can you suggest how to implement such a movement that the character would just walk up and down with normal speed, and if he stops he is not sliding down like it's an icy surface? Just like a person would simply stop in the middle of a slope? (Given that the slope is not too steep of course). Many thanks.
  8. Hi Thanks for the link, I had actually found it before and I tried the code in the answer, but no luck. I'm using v8.0.1. Don't worry, it must be a beginner's mistake that I'm making. I'm still in the beginning and I'm very far from understanding how the whole thing works. I'm sure I'll find it out when I learn more.
  9. Folks I have been playing a little with Melon JS and I really like it. I started with the platformer tutorial which works fine. Now I would like to add a parallax effect to the tile layers as well but I'm stuck. Here's what I tried so far: 1. Add the property "ratio" to the layer - OK it didn't work, it works for image layers only. 2. I have tried to update the layer's position like this: var layer = me.game.world.getChildByName("Background1")[0]; layer.pos.x = layer.pos.x + 1; // move the layer by one pixel But it didn't work, the layer didn't move. Funny thing is, if I add
×
×
  • Create New...