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?
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 😥
@@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..😭😭
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
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
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
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.
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".
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.
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
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.
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 😁
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 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)
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.
Thanks for the recognition! Happy to help and learn with you so thanks to you for your great content! 🙌
You're welcome, I really appreciate the help 😊
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?
@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 👌🏽
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 😥
@@Spellthorn Sorry the delay. How are you playing this audio?
Need the next video tomorrow, please. Really love your content. Keep up with flutter and gaming!💗🔥
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
@@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..😭😭
Yea I'll definitely have more videos dont worry
@@Spellthorn Thanks 🙏
You're welcome
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
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();
}
I dont know why Im commenting, I think because I love your creativity stuff. Hahah
I appreciate it, glad you enjoyed 😊
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
Great advice 😊
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
Yea gravity definitely didn't want to work properly for me could never figure out why it didn't work as supposed to.
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
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.
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".
In the background_tile.dart file
I'm glad you enjoyed them. Yea I forget which version I'm using and not sure of the differences
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.
thank u so much! it really helps me fix the jumping bugs!!
Glad it helped! 😊
I'm facing some alignment issues with joystick,
Love your content from korea❤
Thank you
Thanks for this amazing tutorial ! Just one question, what do you use as recorder for your keyboard touch (bottom left) on your video ?
I'm glad you're enjoying it. The tool is called KeyViz
@@Spellthorn Thanks it's installed :) Yeah, I got some ideas now for personnal project with games. Thanks a lot
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.
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
@@SpellthornPlease can you give me the name of the discord server so i can join up and enquire
@@SpellthornThank you again for this tutorial. I was really confused on how to use everything but your tutorials helped out a lot. Thanks again
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();
}
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);
}
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.
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 😁
Right onnnn🤘🏼💪🏼😎
Glad you enjoyed it
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.
I have the same issue, let me know if you resolved it.
@@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)
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
i am not animationTicker what should i do?
On iOS I have a strange grid when I add the background, someone knows how to fix it?
I went to the Discord channel and I found the solution "flutter run --no-enable-impeller"
Glad you were able to find a solution
Priority didnt worked for me
same here
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.
Same here thank you for responding 🙏
oh I didn't know could be an issue based on version, I've unfortunately been out of the flame loop for a bit 😞
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):
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();
}
}