Coding Snake Game in Svelte.js (Javascript)

Pubblicato il: 16 maggio 2020
sul canale di: Noah Glaser
2,537
53

In this tutorial we'll be using Svelte.JS, an easy to use web framework based on HTML, CSS, and Javascript, to build a snake game. If you don't know Svelte.JS click on the example links below to learn more.

Svelte JS Official Website
https://svelte.dev

Live Demo:
https://phptuts.github.io/snake_game_ty/

Code:
https://github.com/phptuts/snake_game_ty

Starter Code:
https://github.com/phptuts/snake_game...

Example Links

(Props) https://svelte.dev/examples#declaring...

(If Template) https://svelte.dev/examples#if-blocks

(Each Template) https://svelte.dev/examples#each-blocks

(Dom Events) https://svelte.dev/examples#dom-events

(Reactive Declarations) https://svelte.dev/examples#reactive-...

(Svelte Window) https://svelte.dev/examples#svelte-wi...

(Svelte Shorthand Props) https://svelte.dev/repl/72808c5cdce14...

00:00 Introduction

00:20 Starter Code Tour
https://github.com/phptuts/snake_game...

02:02 Food Component Props
https://github.com/phptuts/snake_game...

02:48 SnakeBody Component Props
https://github.com/phptuts/snake_game...

03:59 Creating SnakeBodies
https://github.com/phptuts/snake_game...

05:19 Keyboard Events
https://github.com/phptuts/snake_game...

07:07 Snake Moves
https://github.com/phptuts/snake_game...

08:57 Snake Ate Apple
https://github.com/phptuts/snake_game...

10:47 Game Over Function
https://github.com/phptuts/snake_game...

11:52 Reset Game Function
https://github.com/phptuts/snake_game...

12:34 Challenge
https://github.com/phptuts/snake_game...

13:02 Github Pages
https://github.com/phptuts/snake_game...

13:36 Final Demo and Outro

Notes / Errors

To prevent scrolling with the game have the onKeyDown Method take in an event parameter and call preventDefault. Also, the original game did not allow users to die so easily. So if you are going down you should not be able to go up. These are some minor fixes you can do to make the game better.


In questa pagina del sito puoi guardare il video online Coding Snake Game in Svelte.js (Javascript) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Noah Glaser 16 maggio 2020, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 2,537 volte e gli è piaciuto 53 spettatori. Buona visione!