Mobile Jumping and Fixing Bugs | Create an Amazing Game with Flutter & Flame

Поділитися
Вставка

КОМЕНТАРІ • 65

  • @jhovblack
    @jhovblack 10 місяців тому +8

    Thanks for the recognition! Happy to help and learn with you so thanks to you for your great content! 🙌

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      You're welcome, I really appreciate the help 😊

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      Hey again, so on my fruit this still gives an error where I can collect the fruit over and over if I go outside the collision and back in fast enough. I added back
      bool collected = false
      If (!collected) {
      //animation and remove from parent logic
      }
      Do you think there is a better way to handle this or what i should do?

    • @jhovblack
      @jhovblack 10 місяців тому +1

      @Spellthorn Hi! I guess it is because of the animation. Since it's not completed, the removal is not done yet, so the flag sounds good to me 👌🏽

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      Yea thats what I was thinking too, I couldn't find a way to remove the hitbox so flag it is, up for another challenge? Help me figure out how to play sounds using flame_audio that doesn't crash when restarting in vscode due to
      Os error: The process cannot access the file because it is being used by another process errno = 32
      No clue how to fix this. Got sound working great though just can't restart project after playing, have to close and start again everytime 😥

    • @jhovblack
      @jhovblack 10 місяців тому +1

      @@Spellthorn Sorry the delay. How are you playing this audio?

  • @the_3d_cookie
    @the_3d_cookie 4 місяці тому

    This is an absolute banger of a tutorial. Thank you for taking your time to create this. i've been following this and i'm almost done with the game

  • @dcdales
    @dcdales 5 місяців тому

  • @user-mh4bt9ge9r
    @user-mh4bt9ge9r 4 місяці тому

    thank u so much! it really helps me fix the jumping bugs!!

  • @devasme
    @devasme 10 місяців тому +3

    Need the next video tomorrow, please. Really love your content. Keep up with flutter and gaming!💗🔥

    • @Spellthorn
      @Spellthorn  10 місяців тому +3

      Thats gonna be a bit hard to do, I don't even know what we doing for next video yet 🤣 glad you're enjoying the series

    • @devasme
      @devasme 10 місяців тому

      @@Spellthorn Oh man don't say it now🥹 because you are the reason I am interested in this game in developing using Flutter so don't abandon us for now just do something new because the video about this content is very rare so please do something..😭😭

    • @Spellthorn
      @Spellthorn  10 місяців тому +2

      Yea I'll definitely have more videos dont worry

    • @devasme
      @devasme 10 місяців тому

      @@Spellthorn Thanks 🙏

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      You're welcome

  • @BrianMantel
    @BrianMantel 3 місяці тому

    As for gravity and jump force, all you needed to do was multiply by dt when you apply them to your velocity. If you don't, then you will keep adding the whole amount of acceleration regardless of how much time has passed. On a fast system, you would add acceleration very fast, so you need to scale it down by multiplying by the small dt on a fast system. Then you need to tweak the gravity and jump force numbers, but they will be the same across all platforms and devices

    • @Spellthorn
      @Spellthorn  3 місяці тому +1

      Yea I think I ended up down a long rabbit hole of * dt because I did it once and it didn't work and then I went a different approach to make it work right. I definitely need to tackle this type of game again and improve.

  • @carlosfeliciojr1189
    @carlosfeliciojr1189 2 місяці тому

    If you are having trouble adding parallax and it doesn't fill the screen. Delete the "cam" variable and use the "camera" variable already existing in the FlameGame class

  • @anandyerawar6473
    @anandyerawar6473 3 місяці тому +1

    UPDATE : JOYSTICK
    class JumpButton extends SpriteComponent with HasGameRef {
    JumpButton();
    final margin = 32;
    final buttonSize = 64;
    @override
    FutureOr onLoad() {
    priority = 2; // for visibility on new Version
    sprite = Sprite(game.images.fromCache('HUD/JumpButton.png'));
    position = Vector2(
    game.size.x - margin - buttonSize,
    game.size.y - margin - buttonSize,
    );
    return super.onLoad();
    }

  • @jinchoi3902
    @jinchoi3902 7 місяців тому +1

    thanks for the videos, this is an awesome intro to flutter flame and ive learned so much in a short period of time :)
    wanted to point out that you can fix different jump heights on various platforms of different update delta times by doing the following:
    - in applyGravity, it needs to be velocity.y = _gravity * dt. this makes sure the units are correct (velocity is distance / time, gravity is distance / time^2)
    - tweak jumpForce and gravity to your preference, depending on what kind of level design
    edit: also realized `jumpForce` also needs to be multiplied by delta time to make the units correct, I ran into some collision bugs without it.
    edit2: disregard the above edit, actually doesnt work across devices
    hope this helps anyone who was looking for a solution without implementing fixed delta time

    • @Spellthorn
      @Spellthorn  5 місяців тому

      Yea gravity definitely didn't want to work properly for me could never figure out why it didn't work as supposed to.

  • @TheDorkle
    @TheDorkle 10 місяців тому

    Right onnnn🤘🏼💪🏼😎

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      Glad you enjoyed it

  • @crazyvolt1660
    @crazyvolt1660 9 місяців тому +1

    I dont know why Im commenting, I think because I love your creativity stuff. Hahah

    • @Spellthorn
      @Spellthorn  5 місяців тому

      I appreciate it, glad you enjoyed 😊

  • @minseokjeong1881
    @minseokjeong1881 10 місяців тому

    Love your content from korea❤

  • @AlexanderShustik
    @AlexanderShustik 8 місяців тому +2

    Thank you for the lessons, from Russia with love ♥
    I don't know which version of flame I use, but apparently the last one, and in line 22 I have "gameRef" written, I have been looking for an explanation of this error for a long time, in general, it should be written "game".

    • @AlexanderShustik
      @AlexanderShustik 8 місяців тому

      In the background_tile.dart file

    • @Spellthorn
      @Spellthorn  5 місяців тому

      I'm glad you enjoyed them. Yea I forget which version I'm using and not sure of the differences

  • @prodstalker
    @prodstalker 10 місяців тому

    Thanks for this amazing tutorial ! Just one question, what do you use as recorder for your keyboard touch (bottom left) on your video ?

    • @Spellthorn
      @Spellthorn  10 місяців тому +1

      I'm glad you're enjoying it. The tool is called KeyViz

    • @prodstalker
      @prodstalker 10 місяців тому

      @@Spellthorn Thanks it's installed :) Yeah, I got some ideas now for personnal project with games. Thanks a lot

  • @adrianemacer
    @adrianemacer 10 місяців тому

    I would sugest you override the onTapDown and check if the tapped positionis on the left of the screen then changed the joystick position to the tapped position.

    • @Spellthorn
      @Spellthorn  10 місяців тому

      That's an interesting approach, I went the joystick route as it seemed to be easier to implement for what we we were trying to accomplish however that would be more customizable for sure 😁

  • @dokai8627
    @dokai8627 9 місяців тому

    Thanks for the videos! they are really great! So, im facing a problem with my parallax/scrolling background. I have an Samsung S20+, where i test my projects, and because of the resolution of the screen im facing a little bug. since the old version of scrolling background, in the left part of my screen, under the joystick i can see a white line crossing over the whole width of the screen. i noticed that in the minute 19:56 of your video you faced the same prooblem. Do you figure out how to fix it? i tried put the position of the background as Vector2(1,0) instead of Vector2(0,0) and put 63.4 as size of the tile, but not of these options fixed the problem.

    • @shaiherman9872
      @shaiherman9872 7 місяців тому

      I have the same issue, let me know if you resolved it.

    • @dokai8627
      @dokai8627 7 місяців тому +1

      @@shaiherman9872 i still searching for a solution... im thinking about change the screen resolution of the game itself, to try to cover the whole screen instead of just a small rectangle in the middle of the screen (in my mind that should work, not tested yet)

    • @Spellthorn
      @Spellthorn  2 місяці тому

      Hmmm I'm not sure what would be causing that. I tested my game on real hardware but was s9+ so may be a different resolution not sure sorry

  • @sufikolkol8240
    @sufikolkol8240 6 місяців тому

    i am not animationTicker what should i do?

  • @the_3d_cookie
    @the_3d_cookie 4 місяці тому +1

    I've consistently been having a problem though since the first time the joystick was created. I don't know whether they changed how the priority works or something, but the priority setting doesn't work for the joystick and now the jump button. No matter what number i set it to even though it is high, it is still stuck behind the game . I know because when i turn on debug mode for the game i can see the debug rect just behind the game rect.

    • @Spellthorn
      @Spellthorn  4 місяці тому +1

      A lot of people are saying the same thing. Im not sure if it's something that has been changed or not. I've been kind of out of the loop for a bit sorry. The official discord server should be able to help you. They've been a great help for me the past

    • @the_3d_cookie
      @the_3d_cookie 4 місяці тому

      @@SpellthornPlease can you give me the name of the discord server so i can join up and enquire

    • @the_3d_cookie
      @the_3d_cookie 4 місяці тому

      @@SpellthornThank you again for this tutorial. I was really confused on how to use everything but your tutorials helped out a lot. Thanks again

    • @anandyerawar6473
      @anandyerawar6473 3 місяці тому

      class JumpButton extends SpriteComponent with HasGameRef {
      JumpButton();
      final margin = 32;
      final buttonSize = 64;
      @override
      FutureOr onLoad() {
      priority = 2;
      sprite = Sprite(game.images.fromCache('HUD/JumpButton.png'));
      position = Vector2(
      game.size.x - margin - buttonSize,
      game.size.y - margin - buttonSize,
      );
      return super.onLoad();
      }

    • @anandyerawar6473
      @anandyerawar6473 3 місяці тому

      void addJoystick() {
      // final knobPaint = BasicPalette.blue.withAlpha(200).paint();
      // final backgroundPaint = BasicPalette.blue.withAlpha(100).paint();
      joystick = JoystickComponent(
      priority: 2,
      knob: // CircleComponent(radius: 15,paint: knobPaint),
      SpriteComponent(
      sprite: Sprite(
      images.fromCache('HUD/Knob.png'),
      ),
      ),
      background: //CircleComponent(radius: 50,paint: backgroundPaint),
      SpriteComponent(
      sprite: Sprite(
      images.fromCache('HUD/Joystick.png'),
      ),
      ),
      margin: const EdgeInsets.only(left: 48, bottom: 48),
      );
      add(joystick);
      }

  • @whosjorge23
    @whosjorge23 9 місяців тому

    On iOS I have a strange grid when I add the background, someone knows how to fix it?

    • @whosjorge23
      @whosjorge23 9 місяців тому

      I went to the Discord channel and I found the solution "flutter run --no-enable-impeller"

    • @Spellthorn
      @Spellthorn  2 місяці тому

      Glad you were able to find a solution

  • @devbathani8020
    @devbathani8020 5 місяців тому +1

    Priority didnt worked for me

    • @AugustoBosco
      @AugustoBosco 5 місяців тому

      same here

    • @AugustoBosco
      @AugustoBosco 5 місяців тому

      I noticed that it's an issue with the version of Flame being used, since it works when using the one he uses. I'm trying to figure out how to make it work with the new Flame version.

    • @devbathani8020
      @devbathani8020 5 місяців тому

      Same here thank you for responding 🙏

    • @Spellthorn
      @Spellthorn  5 місяців тому +1

      oh I didn't know could be an issue based on version, I've unfortunately been out of the flame loop for a bit 😞

  • @makecoinfree
    @makecoinfree 6 місяців тому

    parallax error brah
    D/EGL_emulation(10419): app_time_stats: avg=18.98ms min=2.88ms max=186.60ms count=41
    E/flutter (10419): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: Class 'int' has no instance method 'loadParallax'.
    E/flutter (10419): Receiver: 11
    E/flutter (10419): Tried calling: loadParallax(Instance(length:1) of '_GrowableList', baseVelocity: Instance of 'Vector2', repeat: Instance of 'ImageRepeat')
    E/flutter (10419): #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:38:5)
    E/flutter (10419): #1 BackgroundTile.onLoad (package:carlopixeleado/components/background_tile.dart:29:30)
    E/flutter (10419): #2 Component._startLoading (package:flame/src/components/core/component.dart:858:26)
    E/flutter (10419): #3 Component._addChild (package:flame/src/components/core/component.dart:608:20)
    E/flutter (10419): #4 Component.add (package:flame/src/components/core/component.dart:570:46)
    E/flutter (10419): #5 Level._scrollingBackground (package:carlopixeleado/components/level.dart:41:7)
    E/flutter (10419): #6 Level.onLoad (package:carlopixeleado/components/level.dart:24:5)
    E/flutter (10419):
    E/flutter (10419): #7 Component._startLoading. (package:flame/src/components/core/component.dart:860:32)
    E/flutter (10419):
    E/flutter (10419): #8 Future.wait. (dart:async/future.dart:523:21)
    E/flutter (10419):
    E/flutter (10419):