It looks like you're new here. If you want to get involved, click one of these buttons!
Invader = Core.class(Sprite) function Invader:init() local anim1 = {} anim1[1] = Bitmap.new(Texture.new("invader2.png")) anim1[2] = Bitmap.new(Texture.new("invader.png")) local anim1 = MovieClip.new{ {1,20, anim1[1]}, {20,40, anim1[2]}, anim1[1]:setScale(0.3) } anim1:setPosition(0,-5) self:addChild(anim1) anim1:setGotoAction(40, 1) anim1:gotoAndPlay(1) end local maxInvaders = 10 local invaders = {} invadersLayer = Sprite.new() stage:addChild(invadersLayer) local paddx = 75 for i=1, maxInvaders do invaders[i] = Invader.new() invaders[i]:setX(paddx*i) invadersLayer:addChild(invaders[i]) invadersLayer:setScale(0.5) invadersLayer:setPosition(0 ,25) end |
Comments
you should already know how to move the invadersLayer: you're already moving sprites on screen (think about the bullets). You just need to set some limits (as you did on the ship).
Somewhere at the beginning, where you set defaults, you need to set a default direction for the invadersLayer: this will help later, while checking the limits.
Likes: SinisterSoft
invadersLayer:setPosition(getPosition()+5)
Also I'm a newbie not realising I'd already done it
BTW You may find pool stuff easy but for me it's hard -_-
Likes: SinisterSoft
Likes: SinisterSoft