flixel icon indicating copy to clipboard operation
flixel copied to clipboard

Update the official tutorial, "Groundwork" part

Open NikRetaNCAM opened this issue 3 years ago • 8 comments

Discussed in https://github.com/HaxeFlixel/flixel/discussions/2521

Originally posted by NicklGames March 16, 2022 Let me explain myself

If following the tutorial, when reaching this part image this will cause a bug, in which player will constantly move because it's telling to move the player every frame with no condition

It can be easily fixed tho, in 2 ways i know 1: Setting the speed to something only when player is moving and setting it to 0 when player is not image image

2: Adding a boolean that will tell if player is actually moving and move the player only if any of the keys is actually pressed image image

It really is easy, why not update the tutorial (if the reason that it IS easy, then why letting an intentional bug be in an OFFICIAL tutorial?)

NikRetaNCAM avatar Mar 21 '22 14:03 NikRetaNCAM

I don't think so, if you have checked the project the tutorial made, you'll find that the Player.hx uses the same code the tutorial have shown.

NulllStack avatar May 13 '22 10:05 NulllStack

the reason that cause the player moves in a certain direction constantly is probably that you forgot to set the drag.x = drag.y = 1600 (which has described earlier in this chapter this tutorial)?

NulllStack avatar May 13 '22 10:05 NulllStack

and there's another thing, you'll have to put velocity.set(SPEED,0) and velocity.rotate(FlxPoint.weak(0,0), newAngle) inside the if (up || down || left || right) condition due to only execute it only if player pressed the move keys.

NulllStack avatar May 13 '22 10:05 NulllStack

thus if the player not pressing any move keys, the velocity is affected by the drag.x = drag.y = 1600 and it will go back to 0, then the character will stop moving

NulllStack avatar May 13 '22 10:05 NulllStack

I'll add this to the 5.0.0 release. It might be time to revisit this tutorial from the ground up, since newcomers seem to have a lot of friction.

Geokureli avatar May 13 '22 16:05 Geokureli

Hi! @Geokureli , I did checked the discussion #2521 and Im pretty sure the tutorial is correct, the thing is that reader may easily forgot to put velocity.set() and velocity.rotate() inside the if() body that described on 6th step the tutorial shown.

NulllStack avatar May 14 '22 17:05 NulllStack

However, this tutorial has been there for a long time, it would be great to have something new for the newcomers tho :D

NulllStack avatar May 14 '22 17:05 NulllStack

I think the tutorial should be revisited, this part here is quite clunky and only serves to confuse the learner with how roundabout it is for such a basic function. but also yes, we should add new tutorials as well

Geokureli avatar May 14 '22 18:05 Geokureli