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

Поделиться
HTML-код
  • Опубликовано: 29 ноя 2024

Комментарии • 71

  • @jhovblack
    @jhovblack Год назад +9

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

    • @Spellthorn
      @Spellthorn  Год назад +1

      You're welcome, I really appreciate the help 😊

    • @Spellthorn
      @Spellthorn  Год назад +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 Год назад +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  Год назад +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 Год назад +1

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

  • @devasme
    @devasme Год назад +4

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

    • @Spellthorn
      @Spellthorn  Год назад +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 Год назад

      @@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  Год назад +2

      Yea I'll definitely have more videos dont worry

    • @devasme
      @devasme Год назад

      @@Spellthorn Thanks 🙏

    • @Spellthorn
      @Spellthorn  Год назад +1

      You're welcome

  • @the_3d_cookie
    @the_3d_cookie 9 месяцев назад

    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

  • @anandyerawar6473
    @anandyerawar6473 8 месяцев назад +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();
    }

  • @crazyvolt1660
    @crazyvolt1660 Год назад +1

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

    • @Spellthorn
      @Spellthorn  9 месяцев назад

      I appreciate it, glad you enjoyed 😊

  • @carlosfeliciojr1189
    @carlosfeliciojr1189 7 месяцев назад

    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

  • @jinchoi3902
    @jinchoi3902 Год назад +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  9 месяцев назад

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

  • @BrianMantel
    @BrianMantel 8 месяцев назад

    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  8 месяцев назад +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.

  • @AlexanderShustik
    @AlexanderShustik Год назад +3

    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 Год назад

      In the background_tile.dart file

    • @Spellthorn
      @Spellthorn  9 месяцев назад

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

  • @dcdales
    @dcdales 10 месяцев назад

  • @kurisu4959
    @kurisu4959 14 дней назад

    I'm having this issue where the saws from the other levels are still in the game as soon as I proceed to the next level.

  • @你好-v2u
    @你好-v2u 9 месяцев назад

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

    • @Spellthorn
      @Spellthorn  8 месяцев назад

      Glad it helped! 😊

  • @protocol4313
    @protocol4313 3 месяца назад

    I'm facing some alignment issues with joystick,

  • @minseokjeong1881
    @minseokjeong1881 Год назад

    Love your content from korea❤

  • @prodstalker
    @prodstalker Год назад

    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  Год назад +1

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

    • @prodstalker
      @prodstalker Год назад

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

  • @the_3d_cookie
    @the_3d_cookie 9 месяцев назад +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  9 месяцев назад +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 9 месяцев назад

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

    • @the_3d_cookie
      @the_3d_cookie 9 месяцев назад

      @@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 8 месяцев назад

      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 8 месяцев назад

      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);
      }

  • @adrianemacer
    @adrianemacer Год назад

    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  Год назад

      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 😁

  • @TheDorkle
    @TheDorkle Год назад

    Right onnnn🤘🏼💪🏼😎

  • @dokai8627
    @dokai8627 Год назад

    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 Год назад

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

    • @dokai8627
      @dokai8627 Год назад +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  7 месяцев назад

      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 11 месяцев назад

    i am not animationTicker what should i do?

  • @whosjorge23
    @whosjorge23 Год назад

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

    • @whosjorge23
      @whosjorge23 Год назад

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

    • @Spellthorn
      @Spellthorn  7 месяцев назад

      Glad you were able to find a solution

  • @devbathani8020
    @devbathani8020 9 месяцев назад +1

    Priority didnt worked for me

    • @AugustoBosco
      @AugustoBosco 9 месяцев назад

      same here

    • @AugustoBosco
      @AugustoBosco 9 месяцев назад

      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 9 месяцев назад

      Same here thank you for responding 🙏

    • @Spellthorn
      @Spellthorn  9 месяцев назад +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 11 месяцев назад

    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):

    • @protocol4313
      @protocol4313 3 месяца назад

      import 'dart:async';
      import 'package:flutter/material.dart';
      import 'package:flame/components.dart';
      import 'package:flame/parallax.dart';
      import 'package:pixel_adventure/pixel_adventure.dart';
      class BackgroundTile extends ParallaxComponent {
      final String color;
      BackgroundTile({this.color = 'Gray', super.position});
      final double scrollSpeed = 40;
      @override
      FutureOr onLoad() async {
      priority = -10;
      size = Vector2.all(64);
      parallax = await game.loadParallax(
      [ParallaxImageData('Background/$color.png')],
      baseVelocity: Vector2(0, -scrollSpeed),
      repeat: ImageRepeat.repeat,
      fill: LayerFill.none,
      );
      return super.onLoad();
      }
      }