Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change background #5

Open
wants to merge 48 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
04da790
added background and new sprite
githubschman Jun 15, 2017
13432cb
Merge pull request #1 from JHFellows/sarahs-tasks
githubschman Jun 15, 2017
da21162
goodbye toooo youuuu
githubschman Jun 15, 2017
a48219a
adds sprite to team but then doesnt render the sprite?
githubschman Jun 15, 2017
a78419a
need to declare teams in socket file not in game constructor or they …
githubschman Jun 15, 2017
eaa4a0b
added some notes on client game communication flow
githubschman Jun 15, 2017
c0ad791
Merge pull request #2 from JHFellows/michelle
githubschman Jun 15, 2017
477b53e
nothing changed
githubschman Jun 15, 2017
7503fb0
teams work!
githubschman Jun 15, 2017
e6c10f2
food is added in correct spot!
githubschman Jun 15, 2017
6a9b693
it can eat the food!
githubschman Jun 15, 2017
405e450
finally got tile map working
JHFellows Jun 15, 2017
bb17115
food works as it should
githubschman Jun 15, 2017
b69c4ba
Merge pull request #3 from JHFellows/fixing-teams
githubschman Jun 15, 2017
b25580a
purps background
JHFellows Jun 15, 2017
d4b260a
Merge branch 'master' into make-background
JHFellows Jun 15, 2017
04fc68c
Merge pull request #4 from JHFellows/make-background
JHFellows Jun 15, 2017
d8bfba2
changed velocity
githubschman Jun 15, 2017
0e78007
increments team score when player eats
githubschman Jun 15, 2017
d10a854
camera follows only newest player
JHFellows Jun 16, 2017
48d1af8
Merge pull request #5 from JHFellows/camera-follow
JHFellows Jun 16, 2017
2c323c3
anxiety commit
githubschman Jun 16, 2017
33ead5b
Merge branch 'master' into enemy
githubschman Jun 16, 2017
803a65a
Merge pull request #6 from JHFellows/enemy
githubschman Jun 16, 2017
71536e3
spaced out food
githubschman Jun 16, 2017
5c3c2d1
size changes i guess!
githubschman Jun 16, 2017
cd5918c
eating the enemies
githubschman Jun 16, 2017
c7427f1
Merge pull request #7 from JHFellows/food
githubschman Jun 16, 2017
8895bc3
score almost working...
githubschman Jun 16, 2017
4ba130a
leaderboard updates dynamically
JHFellows Jun 16, 2017
06bb968
Merge pull request #8 from JHFellows/leaderboard
JHFellows Jun 16, 2017
94a5fe4
Merge branch 'master' into scores
githubschman Jun 16, 2017
7e0e2b2
collision goes both ways
githubschman Jun 16, 2017
1ca3b82
Merge pull request #9 from JHFellows/scores
githubschman Jun 16, 2017
05ef69e
pls look at the gameover text
githubschman Jun 16, 2017
e6d3d39
Merge pull request #10 from JHFellows/fixing-attacks
githubschman Jun 16, 2017
00b596b
world fits screen and then some
JHFellows Jun 16, 2017
7aa5f9b
Merge branch 'master' into change-world-again
JHFellows Jun 16, 2017
99f7765
meh
JHFellows Jun 16, 2017
20e1ca2
game over text works
JHFellows Jun 16, 2017
015f933
finally decided on this size yesss
JHFellows Jun 16, 2017
1416fd7
Merge pull request #11 from JHFellows/change-world-again
JHFellows Jun 16, 2017
adea7ce
Merge branch 'master' into game-over
JHFellows Jun 16, 2017
ec2a33a
Merge pull request #12 from JHFellows/game-over
JHFellows Jun 16, 2017
a1e66e5
changed leaderboard position and game over text
JHFellows Jun 16, 2017
92473d4
moved game over text up
JHFellows Jun 17, 2017
3c9a3cf
Merge pull request #13 from JHFellows/new-leaderboard
JHFellows Jun 17, 2017
0a40fa0
changed background back to purple
JHFellows Jun 19, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion _client/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
<html>
<head>
<meta charset="UTF-8">
<title>Webpack App</title>
<title>Senna!</title>
</head>
<body>
<script src="/vendor/phaser.min.js"></script>
<script src="/socket.io/socket.io.js"></script>
<section id="gameScreen" class="game-screen"></section>
</body>
</html>
6 changes: 4 additions & 2 deletions _client/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import Fonts from './states/Fonts'
import Game from './states/Game'

class App extends Phaser.Game {
constructor() {
super(24*32, 17*32, Phaser.AUTO);
super(1950, 1070, Phaser.AUTO);

this.state.add('Fonts', Fonts)
this.state.add('Game', Game)
this.state.start('Game')
this.state.start('Fonts')
}
}

Expand Down
15 changes: 13 additions & 2 deletions _client/services/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,43 @@ class Client {
this.socket = io.connect()
var game = theGame

//STEP THREE:
this.socket.on('newplayer',function(data){
game.addNewPlayer(data.id, data.x, data.y)
game.addNewPlayer(data.id, data.x, data.y, data.width, data.height)
})

this.socket.on('allplayers',function(data){
for(var i = 0; i < data.length; i++){
game.addNewPlayer(data[i].id, data[i].x, data[i].y)
game.addNewPlayer(data[i].id, data[i].x, data[i].y, data.width, data.height)
}
})

this.socket.on('move',function(data){
game.movePlayer(data.id,data.x,data.y);
game.eatFood(data.id);
game.attackEnemy(data.id);
game.updateScore(data.id)
})

this.socket.on('remove',function(id){
game.removePlayer(id);
})
}

//STEP TWO:
askNewPlayer() {
this.socket.emit('newplayer')
}

sendClick(x, y) {
this.socket.emit('click', { x, y })
}


sendSize(id, x, y, width, height) {
let data = { id, x, y, width, height, destroy: true }
this.socket.emit('allplayers', data)
}
}

export default Client
28 changes: 28 additions & 0 deletions _client/states/Fonts.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import WebFont from 'webfontloader'

export default class extends Phaser.State {
init () {
this.stage.backgroundColor = 'black'
this.fontsReady = false
this.fontsLoaded = this.fontsLoaded.bind(this)
}

preload () {
WebFont.load({
google: {
families: ['Audiowide']
},
active: this.fontsLoaded
})
}

render () {
if (this.fontsReady) {
this.state.start('Game')
}
}

fontsLoaded () {
this.fontsReady = true
}
}
Loading