I have finally decided I want to try using SC again... I've had an old shooter game project sitting on my computer for a long time, and I wanted some help continuing it.
So far I have the ship that can move around fine and some enemy sprites. What I'd like to know is if there is a way to make enemies appear with one piece of code that affects all of them at once. (I programmed 3 enemies separately)
(sprite 1 is background)
Code so far:
Open Card:
CREATESPRITE 1, "BG"
MOVESPRITE 1,0,0
CREATESPRITE 2, "Ship"
MOVESPRITE 2,100,
CREATESPRITE 3, "UFO"
MOVESPRITE 3, 700, random(300)
CREATESPRITE 4, "UFO"
MOVESPRITE 4, 700, random(300)
CREATESPRITE 5, "UFO"
MOVESPRITE 5, 700, random(300)
ON TIMER (3)
PUSHSPRITE 1, -2,0
PUSHSPRITE 3, -5,0
PUSHSPRITE 4, -5,0
PUSHSPRITE 5, -5,0
END TIMER
Key Down:
IF key$ = uparrow$ THEN
PUSHSPRITE 2,0,-7
END IF
IF key$ = downarrow$ THEN
PUSHSPRITE 2,0,7
END IF
IF key$ = leftarrow$ THEN
PUSHSPRITE 2,-7,0
END IF
IF key$ = rightarrow$ THEN
PUSHSPRITE 2,7,0
END IF
Make sprite 5 your ship.
FOR x = 1 to 4
IF spritevalid(x) = TRUE THEN
Pushsprite x, -5, 0
END IF
NEXT
Not sure if arrays would but that would push them all.
CREATESPRITE 1, "UFO"
CREATESPRITE 2, "UFO"
CREATESPRITE 3, "UFO"
CREATESPRITE 4, "UFO"
CREATESPRITE 6, "BG"
MOVESPRITE 6,0,0
CREATESPRITE 5, "Ship"
MOVESPRITE 5, 50, 180
FOR x = 1 TO 4
IF SPRITEVALID(x) = TRUE THEN
MOVESPRITE x, 700, random(300)
END IF
NEXT
ON TIMER (3)
PUSHSPRITE 6, -2,0
END TIMER
I can understand that I probably did something odd with the enemies (1 through 4) but what about my ship!? All that is shown is the Back Ground...
Or could the background be in front of them? ???