Phaser Failed to load resource: the server responded with a status of 404 (not found)

How to play an animation only if there isnt one yet in Phaser

Questions : How to play an animation only if there isnt one yet in Phaser

2022-08-01T02:35:24+00:00 2022-08-01T02:35:24+00:00

873

What I want to do is play a running anycodings_html animation on a sprite, every time a key is anycodings_html pressed

My code (extract) looks like this:

function update() { if (keys["w"].isDown) { avatar.setVelocityY(-250); } if (keys["d"].isDown) { avatar.setVelocityX(250); } if (keys["a"].isDown) { avatar.setVelocityX(-250); } if (keys["s"].isDown) { avatar.setVelocityY(250); avatar.play("run_front"); } }

The problem: When I hit s, only the first anycodings_html frame of the animation is played and the anycodings_html animation will only finish when I stop anycodings_html pressing it.

I think this is because the animation is anycodings_html overwritten every time I press s.

So how can I run the animation only if the anycodings_html one before isn't playing yet?

Thanks in advance

Total Answers 1

28

Answers 1 : of How to play an animation only if there isnt one yet in Phaser

I found the solution in using anycodings_animation avatar.anims.isPlaying

So what I did is:

if (!avatar.anims.isPlaying) avatar.anims.play("lazy");

0

2022-08-01T02:35:24+00:00 2022-08-01T02:35:24+00:00Answer Link

mRahman

Press J to jump to the feed. Press question mark to learn the rest of the keyboard shortcuts

Search within r/learnjavascript

Phaser Failed to load resource: the server responded with a status of 404 (not found)
r/learnjavascript

Log InSign Up

Found the internet!

Feeds

HomePopular

Explore

ValheimGenshin ImpactMinecraftPokimaneHalo InfiniteCall of Duty: WarzonePath of ExileHollow Knight: SilksongEscape from TarkovWatch Dogs: Legion

NFLNBAMegan AndersonAtlanta HawksLos Angeles LakersBoston CelticsArsenal F.C.Philadelphia 76ersPremier LeagueUFC

The Real Housewives of AtlantaThe BachelorSister Wives90 Day FianceWife SwapThe Amazing Race AustraliaMarried at First SightThe Real Housewives of DallasMy 600-lb LifeLast Week Tonight with John Oliver

Kim KardashianDoja CatIggy AzaleaAnya Taylor-JoyJamie Lee CurtisNatalie PortmanHenry CavillMillie Bobby BrownTom HiddlestonKeanu Reeves

GameStopModernaPfizerJohnson & JohnsonAstraZenecaWalgreensBest BuyNovavaxSpaceXTesla

CardanoDogecoinAlgorandBitcoinLitecoinBasic Attention TokenBitcoin Cash

Animals and PetsAnimeArtCars and Motor VehiclesCrafts and DIYCulture, Race, and EthnicityEthics and PhilosophyFashionFood and DrinkHistoryHobbiesLawLearning and EducationMilitaryMoviesMusicPlacePodcasts and StreamersPoliticsProgrammingReading, Writing, and LiteratureReligion and SpiritualityScienceTabletop GamesTechnologyTravel

Join reddit

Create an account to follow your favorite communities and start taking part in conversations.

Create an account

r/learnjavascript

Posts

1

Posted by2 months ago

Phaser Failed to load resource: the server responded with a status of 404 (not found)

Phaser Failed to load resource: the server responded with a status of 404 (not found)

2 comments

100% Upvoted

Phaser Failed to load resource: the server responded with a status of 404 (not found)

level 1

Op · 2 mo. ago

if i add type='module' i don't get error but on dev side everything is broken

1

level 2

· 2 mo. ago

require is nodejs server side keyword

server routing paths that map to urls require examination when file not found at url

1

How do you fix the server responded with a status of 404 Not Found?

The only way to fix this is to make sure that the CSS and JS files are properly linked within the HTML. Check whether the folder, file and directory name of these files are spelt correctly. Another way to fix this is by using an absolute URL instead of a relative URL.

What does failed to load resource the server responded with a status of 404 not found mean?

As mentioned, a 404 Not Found Error indicates that the client (web browser) is receiving a message from the server (remote computer) that the specific resource (web page/URL) is unavailable.