Skip to content
Browse files

starting the game

  • Loading branch information...
1 parent 1b26115 commit e7416eef1e9278fdeff0031300a8b14e8885b5a8 @igordsm committed Apr 6, 2011
Showing with 48 additions and 46 deletions.
  1. +5 −46 jogo-mico/jogo-mico.js
  2. +28 −0 jogo-mico/tela_inicial.js
  3. +15 −0 jogo-mico/tela_jogo.js
View
51 jogo-mico/jogo-mico.js
@@ -13,58 +13,17 @@ goog.require('lime.animation.FadeTo');
goog.require('lime.animation.ScaleTo');
goog.require('lime.animation.MoveTo');
+goog.require('jogo_mico.tela_inicial');
+goog.require('jogo_mico.tela_jogo');
+
// entrypoint
jogo_mico.start = function(){
- var director = new lime.Director(document.body,320,768),
- scene = new lime.Scene(),
-
- target = new lime.Layer().setPosition(512,384),
- circle = new lime.Circle().setSize(150,150).setFill(255,150,0),
- lbl = new lime.Label().setSize(160,50).setFontSize(30).setText('TOUCH ME!'),
- title = new lime.Label().setSize(800,70).setFontSize(60).setText('Now move me around!')
- .setOpacity(0).setPosition(512,80).setFontColor('#999').setFill(200,100,0,.1);
-
-
- //add circle and label to target object
- target.appendChild(circle);
- target.appendChild(lbl);
-
- //add target and title to the scene
- scene.appendChild(target);
- scene.appendChild(title);
-
+ var director = new lime.Director(document.body,1024,768);
+ var scene = new jogo_mico.tela_jogo();
director.makeMobileWebAppCapable();
- //add some interaction
- goog.events.listen(target,['mousedown','touchstart'],function(e){
-
- //animate
- target.runAction(new lime.animation.Spawn(
- new lime.animation.FadeTo(.5).setDuration(.2),
- new lime.animation.ScaleTo(1.5).setDuration(.8)
- ));
-
- title.runAction(new lime.animation.FadeTo(1));
-
- //let target follow the mouse/finger
- e.startDrag();
-
- //listen for end event
- e.swallow(['mouseup','touchend'],function(){
- target.runAction(new lime.animation.Spawn(
- new lime.animation.FadeTo(1),
- new lime.animation.ScaleTo(1),
- new lime.animation.MoveTo(512,384)
- ));
-
- title.runAction(new lime.animation.FadeTo(0));
- });
-
-
- });
-
// set current scene active
director.replaceScene(scene);
View
28 jogo-mico/tela_inicial.js
@@ -0,0 +1,28 @@
+goog.provide('jogo_mico.tela_inicial');
+
+goog.require('lime.Scene');
+goog.require('lime.Layer');
+
+jogo_mico.tela_inicial = function () {
+ lime.Scene.call(this);
+
+ var target = new lime.Layer().setPosition(512,384),
+ circle = new lime.Circle().setSize(150,150).setFill(255,150,0),
+ lbl = new lime.Label().setSize(160,50).setFontSize(30).setText('TOUCH ME!'),
+ title = new lime.Label().setSize(800,70).setFontSize(60).setText('Now move me around!')
+ .setOpacity(1).setPosition(512,80).setFontColor('#999').setFill(200,100,0,.1);
+
+
+ //add circle and label to target object
+ target.appendChild(circle);
+ target.appendChild(lbl);
+
+ //add target and title to the scene
+ this.appendChild(target);
+ this.appendChild(title);
+};
+
+
+goog.inherits(jogo_mico.tela_inicial, lime.Scene);
+
+goog.exportSymbol('jogo_mico.tela_inicial', jogo_mico.tela_inicial);
View
15 jogo-mico/tela_jogo.js
@@ -0,0 +1,15 @@
+goog.provide('jogo_mico.tela_jogo');
+
+goog.require('lime.Scene');
+goog.require('lime.Layer');
+goog.require('lime.Label');
+
+jogo_mico.tela_jogo = function () {
+ lime.Scene.call(this);
+ var title = new lime.Label().setSize(800,70).setFontSize(60).setText('JOGO').setPosition(512,80).setFontColor('#999').setFill(200,100,0,.1);
+ this.appendChild(title);
+};
+
+goog.inherits(jogo_mico.tela_jogo, lime.Scene);
+
+goog.exportSymbol('jogo_mico.tela_jogo', jogo_mico.tela_jogo);

0 comments on commit e7416ee

Please sign in to comment.
Something went wrong with that request. Please try again.