Skip to content

Commit

Permalink
Merge pull request #15 from ehgoodenough/v0.3.0
Browse files Browse the repository at this point in the history
V0.3.0
  • Loading branch information
ehgoodenough committed Dec 14, 2015
2 parents 535d713 + 5bd9a8b commit 4c71043
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 12 deletions.
2 changes: 2 additions & 0 deletions source/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ section {
font-size: $font-size;
}*/

padding: 32em;

div {
margin-bottom: 1em;
}
Expand Down
2 changes: 1 addition & 1 deletion source/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html">
<meta name="viewport" content="maximum-scale=1, width=device-width, initial-scale=1">
<title>Magic Garden - Ludum Dare 34</title>
<title>Sproutsong - Ludum Dare 34</title>
</head>
<body>
<div id="mount"></div>
Expand Down
42 changes: 31 additions & 11 deletions source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class Gardener {
if(plant.harvestable) {
this.inventory.push(plant)
game.plants.remove(plant)
sounds["harvesting"].play()
//sounds["harvesting"].play()
}
}

Expand All @@ -298,7 +298,9 @@ class Gardener {
&& this.direction.tx == 0 && this.direction.ty == -1)
|| (this.position.tx0 == 20 && this.position.ty0 == 4
&& this.direction.tx == +1 && this.direction.ty == 0)) {
game.state = new ShoppingState()
if(this.holding == undefined) {
game.state = new ShoppingState()
}
} else if((this.position.tx0 == 25 && this.position.ty0 == 5
&& this.direction.tx == 0 && this.direction.ty == -1)
|| (this.position.tx0 == 26 && this.position.ty0 == 4
Expand Down Expand Up @@ -551,6 +553,15 @@ sounds["grow1"] = new Audio(require("./sounds/growing1.mp3"))
sounds["grow2"] = new Audio(require("./sounds/growing2.mp3"))
sounds["grow3"] = new Audio(require("./sounds/growing3.mp3"))

sounds["singing1"] = new Audio(require("./sounds/singing1.mp3"))
sounds["singing2"] = new Audio(require("./sounds/singing2.mp3"))
sounds["singing3"] = new Audio(require("./sounds/singing3.mp3"))
sounds["singing4"] = new Audio(require("./sounds/singing4.mp3"))
sounds["singing5"] = new Audio(require("./sounds/singing5.mp3"))
sounds["singing6"] = new Audio(require("./sounds/singing6.mp3"))
sounds["singing7"] = new Audio(require("./sounds/singing7.mp3"))
sounds["singing8"] = new Audio(require("./sounds/singing8.mp3"))

sounds["walk1"].volume = 0.5
sounds["walk2"].volume = 0.5

Expand Down Expand Up @@ -726,6 +737,12 @@ var plants = window.plants = [
}
})
}
if(!this.sound || this.sound.ended) {
this.sound = sounds["singing" + (Math.floor(Math.random() * 8) + 1)]
this.sound.play()
}
var distance =getDistanceBetweenPoints(this.position, game.gardener.position)
this.sound.volume = (1 - (Math.min(distance / (TILE * 8), 1)))
}
},
{
Expand Down Expand Up @@ -811,6 +828,13 @@ var plants = window.plants = [
}
]

var getDistanceBetweenPoints = function(p1, p2) {
var x = p1.x - p2.x
var y = p1.y - p2.y

return Math.sqrt((x * x) + (y * y))
}

class Plant {
constructor(that) {
this.position = that.position
Expand Down Expand Up @@ -1182,13 +1206,7 @@ class AboutState {
plants to sell at the market!
</div>
<div>
...put better blurb here...
</div>
<div>
We are Jam Sandwich!
</div>
<div>
We hope you enjoy the game!
Your family's farm has long been known as the best provider of magical plants of all kinds. Tend to the crops and sell them at the…farm has long been known as the best provider of magical plants of all kinds. Tend to the crops and sell them at the family store, Mystic Flora
</div>
<div>
Developed for Ludum Dare 34, where the theme was <b>Growing.</b>
Expand All @@ -1198,6 +1216,9 @@ class AboutState {
<a href="http://twitter.com/madameberry" target="_blank">Art: @madameberry</a>
<a href="http://twitter.com/mcfunkypants" target="_blank">Sound: @mcfunkypants</a>
</div>
<div>
We hope you enjoy the game!
</div>
</section>
</div>
)
Expand Down Expand Up @@ -1319,8 +1340,6 @@ class ShoppingState {
if(game.gardener.gold - plant.price >= 0) {
game.gardener.gold -= plant.price
game.gardener.holding = plant
game.gardener.animation = "spin"
game.gardener.animating = 1000
game.gardener.seed = plant
game.cursor = 0
game.state = new FarmingState()
Expand All @@ -1340,6 +1359,7 @@ if(STAGE == "PRODUCTION") {
game.state = new TitleState()
} else if(STAGE == "DEVELOPMENT") {
game.state = new FarmingState()
game.state = new AboutState()
music.pause()
}
game.cursor = 0
Expand Down
Binary file added source/sounds/singing1.mp3
Binary file not shown.
Binary file added source/sounds/singing2.mp3
Binary file not shown.
Binary file added source/sounds/singing3.mp3
Binary file not shown.
Binary file added source/sounds/singing4.mp3
Binary file not shown.
Binary file added source/sounds/singing5.mp3
Binary file not shown.
Binary file added source/sounds/singing6.mp3
Binary file not shown.
Binary file added source/sounds/singing7.mp3
Binary file not shown.
Binary file added source/sounds/singing8.mp3
Binary file not shown.

0 comments on commit 4c71043

Please sign in to comment.