Made ocean faster and move randomly every 2 frames.

This commit is contained in:
Robbie Antenesse 2016-04-06 14:47:32 -06:00
parent 02e70bcf73
commit 84434851a1
1 changed files with 8 additions and 8 deletions

View File

@ -1,4 +1,4 @@
var ani_ocean = OS.A.Add("Ocean", 256, 256, {columns: 10, speed: 1/120}); var ani_ocean = OS.A.Add("Ocean", 256, 256, {columns: 10, speed: 1/60});
function oceanTilePrefab() {} function oceanTilePrefab() {}
@ -11,7 +11,7 @@ var pr_ocean = OS.P.Add("Ocean Particle", {
positionCheckProgress: 30, positionCheckProgress: 30,
doCheckPosition: false, doCheckPosition: false,
moveTimer: 1 / OS.S.defaultStep, moveTimer: 0,
}); });
pr_ocean.BeforeDo = function () { pr_ocean.BeforeDo = function () {
@ -23,11 +23,11 @@ pr_ocean.BeforeDo = function () {
} }
pr_ocean.Do = function () { pr_ocean.Do = function () {
// Move around randomly. // Move around randomly.
this.moveTimer--; this.moveTimer++;
if (this.moveTimer <= 0) { if (this.moveTimer >= 120) {
this.x += Math.round(Math.randomRange(-1, 1)) * OS.S.pixelScale; this.x += 1 * Math.round(Math.randomRange(-1, 1)) * OS.S.pixelScale;
this.y += Math.round(Math.randomRange(-1, 1)) * OS.S.pixelScale; this.y += 1 * Math.round(Math.randomRange(-1, 1)) * OS.S.pixelScale;
this.moveTimer = 1 / OS.S.defaultStep; this.moveTimer = 0;
} }
} }
@ -78,4 +78,4 @@ pr_ocean.CheckPosition = function (checkX, checkY, direction) {
this.doCheckPosition = false; this.doCheckPosition = false;
} }
} }