Permalink
Browse files

Update

  • Loading branch information...
1 parent 03967df commit 9a855d29828b180f43adef20abc8cc4fbd3f3fcf @srivello srivello committed May 21, 2012
@@ -26,7 +26,7 @@
--------------------------------------
-- Imports
--------------------------------------
-
+require ("sprite");
--------------------------------------
-- Metadata
@@ -64,6 +64,9 @@ function AbstractGroup()
This property is designed to...
--]]
local me = display.newGroup();
+ local image;
+
+ print ("in the absractgroup---------------")
--------------------------------------
-- Constructor
@@ -78,19 +81,45 @@ function AbstractGroup()
--RETURN
return me;
- end
-
+ end
+
--[[
This is the initialize.
--]]
- function me:initialize(aX_num, aY_num)
+ function me:initialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num)
--TRACE
- print ("AbstractGroup:initialize()");
+ print (">>>>>>AbstractGroup:initialize()");
+
+ --DRAW
+
+ --FLYER IS A SPRITE SHEET, THE OTHERS ARE 1 IMAGE
+ if aURL_str == "./media/images/flyer.png" then
+ -- A sprite sheet with a cat
+ local sheet1 = sprite.newSpriteSheet( aURL_str, 69, 69 )
+
+ local spriteSet1 = sprite.newSpriteSet(sheet1, 1, 2)
+ sprite.add( spriteSet1, "moveOnce", 1, 2, 300, 1 ) -- play 8 frames every 1000 ms
+
+ image = sprite.newSprite( spriteSet1 )
+ image.xScale = 1
+ image.yScale = 1
+
+ image:prepare("moveOnce")
+ image:play()
+
+ else
+
+ image = display.newImageRect(aURL_str, aWidth_num, aHeight_num);
+ image:setReferencePoint( display.TopLeftReferencePoint )
+ me:insert (image);
+
+ end
+
--PROPERTIES
- me.x = aX_num;
- me.y = aY_num;
+ image.x = aX_num;
+ image.y = aY_num;
end
@@ -106,14 +135,7 @@ function AbstractGroup()
-- Events
--------------------------------------
-- PUBLIC
- --[[
- -- The Game Loop (Movement, Etc...)
- --]]
- function me:enterFrame( event )
- print"tick2----------"
- me.x = me.x + 10;
-
- end
+
-- RETURN INSTANCE VIA CONSTRUCTOR
return me:constructor();
@@ -0,0 +1,109 @@
+--[[
+ -- Copyright (C) 2006-2012 Rivello Multimedia Consulting.
+ -- code [at] RivelloMultimediaConsulting [dot] com
+ --
+ -- Permission is hereby granted, free of charge, to any person obtaining
+ -- a copy of this software and associated documentation files (the
+ -- "Software"), to deal in the Software without restriction, including
+ -- without limitation the rights to use, copy, modify, merge, publish,
+ -- distribute, sublicense, and#or sell copies of the Software, and to
+ -- permit persons to whom the Software is furnished to do so, subject to
+ -- the following conditions:
+ --
+ -- The above copyright notice and this permission notice shall be
+ -- included in all copies or substantial portions of the Software.
+ --
+ -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ -- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ -- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ -- IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ -- OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ -- ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ -- OTHER DEALINGS IN THE SOFTWARE.
+--]]
+-- Marks the right margin of code *******************************************************************
+
+--------------------------------------
+-- Imports
+--------------------------------------
+
+--------------------------------------
+-- Metadata
+--------------------------------------
+module (..., package.seeall)
+
+--------------------------------------
+-- Class Methods
+--------------------------------------
+-- PUBLIC STATIC
+
+
+--------------------------------------
+-- Class Properties
+--------------------------------------
+-- PUBLIC STATIC
+
+
+--------------------------------------
+-- Class
+--------------------------------------
+--[[
+ This class is designed to...
+--]]
+function DirectionalKeypad(aTable, aX_num, aY_num, aWidth_num, aHeight_num)
+
+ --------------------------------------
+ -- Properties
+ --------------------------------------
+
+ -- PUBLIC
+
+ -- PRIVATE
+ --[[
+ This property is designed to...
+ --]]
+ local me = display.newGroup();
+
+ --------------------------------------
+ -- Constructor
+ --------------------------------------
+ --[[
+ This is the constructor...
+ --]]
+ function me:constructor()
+
+ --TRACE
+ print ("DirectionalKeypad:constructor()");
+
+ --RETURN
+ return me;
+ end
+
+ --[[
+ This is the initialize.
+ --]]
+ function me:initialize(aX_num, aY_num, aWidth_num, aHeight_num)
+
+ --TRACE
+
+
+ end
+
+ --------------------------------------
+ -- Methods
+ --------------------------------------
+
+ -- PUBLIC
+
+ -- PRIVATE
+
+ --------------------------------------
+ -- Events
+ --------------------------------------
+ -- PUBLIC
+
+
+ -- RETURN INSTANCE VIA CONSTRUCTOR
+ me:initialize(aX_num, aY_num, aWidth_num, aHeight_num)
+ return me:constructor();
+end
@@ -76,20 +76,13 @@ function BackgroundImage(aTable, aURL_str)
This is the initialize.
--]]
me.superInitialize = me.initialize;
- function me:initialize(aURL_str)
+ function me:initialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num)
--TRACE
print ("BackgroundImage:initialize()");
--SUPER
- me:superInitialize();
-
- --DRAW
- local image = display.newImageRect(aURL_str, display.contentWidth, display.contentHeight )
- image:setReferencePoint( display.TopLeftReferencePoint )
- image.x = 0;
- image.y = 0;
- me:insert (image);
+ me:superInitialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num)
end
@@ -108,6 +101,6 @@ function BackgroundImage(aTable, aURL_str)
-- PUBLIC
-- RETURN INSTANCE VIA CONSTRUCTOR
- me:initialize(aURL_str);
+ me:initialize(0, 0, aURL_str, display.contentWidth, display.contentHeight );
return me:constructor();
end
@@ -56,19 +56,14 @@ function Biplane(aTable, aX_num, aY_num, aXSpeed_num)
--------------------------------------
-- Properties
--------------------------------------
-
+ print ("in the biplane---------------")
-- PUBLIC
-- PRIVATE
--[[
Self reference.
--]]
- local me = AbstractGroup:AbstractGroup();
-
- --[[
- The speed to move each frame
- --]]
- local xSpeed_num = aXSpeed_numl
+ local me = AbstractGroup:AbstractGroup();
--------------------------------------
-- Constructor
@@ -77,26 +72,24 @@ function Biplane(aTable, aX_num, aY_num, aXSpeed_num)
Only The Parent-Most class has a constructor
--]]
- --[[
+ --[[
This is the initialize.
--]]
me.superInitialize = me.initialize;
- function me:initialize(aX_num, aY_num)
+ function me:initialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num, aXSpeed_num)
--TRACE
- print ("Biplane:initialize()");
+ print ("Biplane:initialize(2)");
+ --SET SPEED
+ me.xSpeed_num = aXSpeed_num;
+
--SUPER
- me:superInitialize(aX_num, aY_num);
-
- --DRAW
- local image = display.newImageRect("./media/images/biplane.png", 41, 36 )
- image:setReferencePoint( display.TopLeftReferencePoint )
- me:insert (image);
-
+ me:superInitialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num)
+
end
-
+
--------------------------------------
-- Methods
--------------------------------------
@@ -109,8 +102,25 @@ function Biplane(aTable, aX_num, aY_num, aXSpeed_num)
-- Events
--------------------------------------
-- PUBLIC
+ -- PUBLIC
+ --[[
+ -- The Game Loop (Movement, Etc...)
+ --]]
+ function me:enterFrame( event )
+
+ --MOVE POSITION
+ me.x = me.x + me.xSpeed_num;
+
+ --CORRECT POSITION IF OFFSCREEN
+ if me.x - me.width > display.contentWidth then
+ me.x = -me.width;
+ elseif me.x + me.width < 0 then
+ me.x = display.contentWidth;
+ end
+
+ end
-- RETURN INSTANCE VIA CONSTRUCTOR
- me:initialize(aX_num, aY_num);
+ me:initialize(aX_num, aY_num, "./media/images/biplane.png", 41, 36, aXSpeed_num );
return me:constructor();
-end
+end
@@ -26,7 +26,7 @@
--------------------------------------
-- Imports
--------------------------------------
-local AbstractGroup = require ("com.rmc.components.AbstractGroup");
+local Enemy = require ("com.rmc.projects.flyergame.groups.Enemy");
--------------------------------------
-- Metadata
@@ -63,12 +63,7 @@ function Blimp(aTable, aX_num, aY_num, aXSpeed_num)
--[[
Self reference.
--]]
- local me = AbstractGroup:AbstractGroup();
-
- --[[
- The speed to move each frame
- --]]
- local xSpeed_num = aXSpeed_numl
+ local me = Enemy:Enemy();
--------------------------------------
-- Constructor
@@ -80,19 +75,14 @@ function Blimp(aTable, aX_num, aY_num, aXSpeed_num)
--[[
This is the initialize.
--]]
- me.superInitialize = me.initialize;
- function me:initialize(aX_num, aY_num)
+ me.superSuperInitialize = me.superInitialize;
+ function me:initialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num, aXSpeed_num)
--TRACE
- print ("Blimp:initialize()");
+ print ("Biplane:initialize()");
--SUPER
- me:superInitialize(aX_num, aY_num);
-
- --DRAW
- local image = display.newImageRect("./media/images/blimp.png", 86, 31 )
- image:setReferencePoint( display.TopLeftReferencePoint )
- me:insert (image);
+ me:superInitialize(aX_num, aY_num, aURL_str, aWidth_num, aHeight_num, aXSpeed_num)
end
@@ -111,6 +101,6 @@ function Blimp(aTable, aX_num, aY_num, aXSpeed_num)
-- PUBLIC
-- RETURN INSTANCE VIA CONSTRUCTOR
- me:initialize(aX_num, aY_num);
+ me:initialize(aX_num, aY_num, "./media/images/blimp.png", 86, 31, aXSpeed_num );
return me:constructor();
end
Oops, something went wrong.

0 comments on commit 9a855d2

Please sign in to comment.