Skip to content

Instantly share code, notes, and snippets.

View zardilior's full-sized avatar
🎯
Hitting my goals

Jose Estremadoyro zardilior

🎯
Hitting my goals
View GitHub Profile
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/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
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/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
<!DOCTYPE HTML>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/phaser@3.15.1/dist/phaser-arcade-physics.min.js"></script>
</head>
<body>
<script>
var config = {
type: Phaser.AUTO,
width: 800,
// 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)
}