Topic: Game Programming /
Need help with several problems(such as enemy clipping and loading movieclips into an array)
I am very new to as3 and due to me being sick I am behind on schedule and I could really use some help. Basically I made a top down evasion game. Using this tutorial as a basis http://www.flashgametuts.com/tutorials/as3/how-to-make-a-vertical-shooter-in-as3-part-1/.
I have several problems I have to solve:
1: I need a scrolling background.(I do this using to movieclips but they wont switch to another value for y)
2: I need to prevent my enemies from clipping (I use multiple sorts of enemies).
3: I need to load enemies into an array to spawn them in a pattern.
Probably the most easy one is that I need and endless scrolling background.
It basically are two versions of a movieclip scrolling down and when reaching a certain value for y they should move back up. It starts of good, meaning the 2 versions scroll down but they won’t move back up.
This is the code I am using:
//The speed of the scroll movement.
var scrollSpeed:uint = 6;
//This adds two instances of the movie clip onto the stage.
var s1:ScrollBg = new ScrollBg();
var s2:ScrollBg = new ScrollBg();
//This positions the second movieclip next to the first one.
s1.y = 0;
s2.y = s1.height;
//Adds an event listener to the stage.
//This function moves both the images to left. If the first and second
//images goes pass the left stage boundary then it gets moved to
//the other side of the stage.
s1.y += scrollSpeed;
s2.y += scrollSpeed;
if (s1.y < - s1.height)
s1.y = s2.height;
else if (s2.y < -s1.height)
s2.y = s2.height;
For the enemies I use this code here
and here http://www.flashgametuts.com/tutorials/as3/how-to-make-a-vertical-shooter-in-as3-part-4/
I dont want the enemies to overlap each other so i thought i would make them hit test each other and removing one of them when the hit test is true but nothing happens.
Also I need to spawn a pattern of enemies Could you possibly help me on that?
Sorry for the wall of text, but I really need help and any help would be appreciated.
Thanks in advance.