• Content Count

  • Joined

  • Last visited

About Embarissed

  • Rank

Recent Profile Visitors

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

  1. Finally got it! Had to make a slight change to your code @Parasyte. this.body.update(dt); this.body.falling = (this.body.vel.y) != 0; this.body.jumping = (this.body.falling ? false : this.body.jumping); Thanks for the help!
  2. Haha, if I didn't have a double jump I would be in the clear. The code I used is very similar to the what he did for his game, I just have it so that touching an item causes the flip instead. The collision.y < 0 looked very promising but anytime I try to use updateMovement() in any way, I get the error that updateMovement() is not a function.
  3. It is still not working, there was a very small change I noticed however. With gravity reversed, if I quickly tap jump twice and hit the now ceiling (originally the ground), it will disable jump til I land. It's kind of hard to explain, but while in mid air, ill jump, then hit jump 2 more times before hitting the ceiling, then fall to the ground, assumingly hitting the 3 this.multiplejump. Something I noticed also was that while holding left or right, the animation for walking was used instead of my jumping. But only for about for a half second after using a multi jump, then it resumed with the jumping animation. Again, normal gravity still works perfectly, even with the added lines. Feel free to try it out, http://godawg.xyz/game/index.html At the start, jump up and to the left to be taken to an area with the flip.
  4. Well yeah. That's where I got that code from originally. That flag however else if (!this.body.falling && !this.body.jumping) { // reset the multipleJump flag if on the ground this.multipleJump = 1; is repeatedly triggered while gravity is negative during mid-jump (checked with breakpoints). My double jump works perfectly while the gravity is > 0. The only thing I can think of is that while gravity is flipped the engine believes falling upward does not count as this.body.falling. Just wondering if there is a logical way to get around this or some property that I don't know of that could help in this situation.
  5. You would think it would be " +=" but it's not. To get a full jump, no matter where you are falling it has to just be " = " or else it just does a sort of short hop. Not sure what you mean about the last "else if". It does get called when I run off a platform then do my double jump. Edit: Cancel that second statement, after further testing, it is definitely not working as intended, just a short hop. Edit 2: Changed statements to If, works as intended. Thanks Idd. Reverse Double jump still infinite.
  6. Hello, been stuck on this for a few days now and figure I'd try asking. In my platformer, my character can double jump. The problem is when I flip this.body.gravity, the character can double jump forever. if (me.input.isKeyPressed("jump")) { this.renderable.setCurrentAnimation("jump"); if (this.multipleJump <= 2 && this.body.gravity > 0) { // easy "math" for double jump this.body.vel.y -= (this.body.maxVel.y * this.multipleJump++) * me.timer.tick; this.body.jumping = true; me.audio.play("jump", false); }else if(this.multipleJump <= 2 && this.body.gravity < 0) { this.body.vel.y = (this.body.maxVel.y * this.multipleJump++) * me.timer.tick; this.body.jumping = true; me.audio.play("jump", false); } } if (this.body.jumping || this.body.falling){ this.renderable.setCurrentAnimation("jump"); } else if (!this.body.falling && !this.body.jumping) { // reset the multipleJump flag if on the ground this.multipleJump = 1; } else if (this.body.falling && this.multipleJump < 2) { // reset the multipleJump flag if falling this.multipleJump = 2; } And here is the code for the gravity flip, case me.collision.types.ACTION_OBJECT: if(other.type === "flip") { this.body.gravity = -this.body.gravity; this.renderable.flipY(this.body.gravity < 0); } break; I know the problem is with the second else if. While in midair the flag is being reset and it's probably because falling upwards doesn't count as falling. I have tried using body.vel.y <= 0 instead of falling and that did not work. I've checked the Body documentation and didn't see anything that could help me. Here again is the link to the github if you need to see more, https://github.com/embarissed/godawggaming/blob/master/js/entities/entities.js Thanks again!
  7. Embarissed


    Thank you so much! First part worked like a charm, and just like you said, it continued through to the title screen. I just added, onDestroyEvent : function () { //just in case this.tween.stop(); } and that seems to work fine, but I appreciate the knowledge about level loaded in case I need it later.
  8. Embarissed


    Just for clarification, where is the level loaded event? I didn't think I had one, only a resetEvent when loading the game in play.js And I'm ashamed to say it but I'm not sure how to add persistence specifically to the tween. I have it added to the HUD container with the clock added as a child but obviously that isn't working. Again, thanks for taking time out of your day to help.
  9. Embarissed


    I should have mentioned in the original post, I actually want the timer to continue across all levels as I will have many short levels and a longer timer. If I understand what you are saying, that would reset the clock after each level? I think I am having trouble understanding why life and score keep updating yet the timer stops.
  10. Embarissed


    First off, thanks for all the work and effort the commenters do to help us little guys out. I have a timer in my platformer game, with help from The Uncertainty Principle by Radmars, in my HUD.js with the following code, https://github.com/embarissed/godawggaming/blob/master/js/entities/HUD.js The life and score work correctly across multiple levels. The timer works on the first level (including changing to game over screen,) but freezes when the second level is loaded. I've been stumped by this for a few days so I figured I'd ask for help. Thank you.
  11. I understood that. That's why in the tutorial it says to manually add the fonts to the resource list. I can't imagine however that you are supposed to manually add them every single time you make a change ie. change a tmx file or add a sprite. But, thanks Parasyte, adding the following code, ,{ src: ['data/fnt/**/*.fnt'], type: 'binary' },{ src: ['data/fnt/**/*.png'], type: 'image' } Had it add the fonts automatically. This wasn't in the tutorial though, so I'm still confused as to if this is just a workaround or the correct way to fix this problem. But for now, I'll take it.
  12. I do not think the file is corrupted. I redownloaded the Tutorial_data files and replaced everything in the fnt folder but am still getting the same error. Also, the HUD displays the score correctly, if I manually enter the font into build/js/resources.js after every build. It's specifically fonts though, as my tilesheets are still being added to the resources list. Any other ideas?
  13. Hi. I just finished the tutorial but have a problem I can't quite figure out. In the tutorial, it says to add // game font { name: "PressStart2P", type:"image", src: "data/fnt/PressStart2P.png" }, { name: "PressStart2P", type:"binary", src: "data/fnt/PressStart2P.fnt"}, So originally I added this to build/js/resources.js because this is the only resources.js I had. I added the fonts to that file and it worked until it was rebuilt then it would disappear. Then I noticed I am supposed to have a resources.js in my boilerplate/js folder, so I copied the one from the build into there but that file is not getting read as it says "Uncaught File containing font data was empty, cannot load the bitmap font." Did I miss a step somewhere? Sorry if this has an obvious answer.