lessons from the boilerplates for teaching games programming using drussell1974/phaser_edu
- Use feature branches to develop code
- master/
|- dev/
|- feature/<name>/
- Use the template to create a directory in source
<name>
|- activity
| - web2py.<name>.activity.w2p
|- solution
| - web2py.<name>.solution.w2p
- Checkout the dev branch
git checkout dev
git pull
- Create a new feature branch from the dev branch
git branch feature/<name>
- Use the following command to create a directory
After running the command you will be prompted to enter a name (no spaces - use underscore)
yarn run create_activity
Show the name of your activity shown in the browser tab by editing the title in the index.html
- Open the index.html
- Update the e.g. <title>Use collision detection</title>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<!-- feature title -->
<title>Create an animated sprite</title>
<!-- get the phaser3 framework when page is loading -->
<script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script>
<style type="text/css">
body {
margin: 0;
}
</style>
</head>
<body>
<!-- Load the game from the javascript file game.js -->
<!-- This is run in the body after page has loaded -->
<script src="js/game.js"></script>
</body>
</html>
- Open js/game.js
var config = {
type: Phaser.AUTO,
width: 800,
height: 600,
physics: {
default: 'arcade',
arcade: {
gravity: { y: 300 },
debug: false
}
},
scene: {
preload: preload,
create: create,
update: update
}
};