This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser-arcade-physics.min.js"></script> | |
<script> | |
// Shooter part 1 | |
/* | |
Load an image | |
insert it | |
Move our ship with arrow keys | |
Change position first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser-arcade-physics.min.js"></script> | |
<script> | |
// Shooter part 1 | |
/* | |
Load an image | |
insert it | |
Move our ship with arrow keys | |
Change position first |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html> | |
<head> | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/phaser-arcade-physics.min.js"></script> | |
</head> | |
<body> | |
<script> | |
var config = { | |
type: Phaser.AUTO, | |
width: 800, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// flatten arrays with a recursive function | |
function flattenArray(array){ | |
let flattenedArray = [] | |
for(let element of array) { | |
if(Array.isArray(element)) { | |
flattenedArray.push(...flattenArray(element)) | |
} | |
else { | |
flattenedArray.push(element) | |
} |