Skip to content

Commit

Permalink
feat(Dark Rooms):
Browse files Browse the repository at this point in the history
 Added light flickering.
 Changed % of occurrence to 5%
Closes #9
  • Loading branch information
D0NM committed Jan 21, 2015
1 parent 37c5dec commit 76937ae
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,31 @@ waw.MainLayer = cc.Layer.extend({
this.lightspot4.setRotation(270);
this.lightspot4.setPosition(160, 120);

this.lightspot1.runAction(new cc.RepeatForever(
new cc.Sequence(
new cc.ScaleTo(0.2 + Math.random(), 0.98),
new cc.ScaleTo(0.2 + Math.random(), 1)
)
));
this.lightspot2.runAction(new cc.RepeatForever(
new cc.Sequence(
new cc.ScaleTo(0.2 + Math.random(), 0.98),
new cc.ScaleTo(0.2 + Math.random(), 1)
)
));
this.lightspot3.runAction(new cc.RepeatForever(
new cc.Sequence(
new cc.ScaleTo(0.2 + Math.random(), 0.98),
new cc.ScaleTo(0.2 + Math.random(), 1)
)
));
this.lightspot4.runAction(new cc.RepeatForever(
new cc.Sequence(
new cc.ScaleTo(0.2 + Math.random(), 0.98),
new cc.ScaleTo(0.2 + Math.random(), 1)
)
));

this.addChild(this.lightspot1, 399);
this.addChild(this.lightspot2, 399);
this.addChild(this.lightspot3, 399);
Expand Down Expand Up @@ -252,6 +277,8 @@ waw.MainLayer = cc.Layer.extend({
if (room) {
currentRoomY -= 1;
transition = cc.TransitionSlideInT; //effect - scrolls one scene out
this.lightspot3.visible = false;
this.lightspot4.visible = false;
} else
return;
break;
Expand All @@ -260,6 +287,8 @@ waw.MainLayer = cc.Layer.extend({
if (room) {
currentRoomY += 1;
transition = cc.TransitionSlideInB;
this.lightspot1.visible = false;
this.lightspot2.visible = false;
} else
return;
break;
Expand All @@ -268,6 +297,8 @@ waw.MainLayer = cc.Layer.extend({
if (room) {
currentRoomX -= 1;
transition = cc.TransitionSlideInL;
this.lightspot2.visible = false;
this.lightspot3.visible = false;
} else
return;
break;
Expand All @@ -276,6 +307,8 @@ waw.MainLayer = cc.Layer.extend({
if (room) {
currentRoomX += 1;
transition = cc.TransitionSlideInR;
this.lightspot1.visible = false;
this.lightspot4.visible = false;
} else
return;
break;
Expand Down
2 changes: 1 addition & 1 deletion src/level.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ rooms.genLevel = function() {
r.walls.bottom = "start";
r.type = 0; //clean room. no obstacles in it
} else {
if(Math.random() <= 0.1)
if(Math.random() <= 0.05)
r.dark = true;
}

Expand Down

0 comments on commit 76937ae

Please sign in to comment.