This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

danpost presents ...


Space Invaders Movement Demo

Left and Right arrows to move. Up arrow to shoot.

I created an actor called 'Row' to track (by using 'getIntersectingObjects') the invaders on each row and had the world tell each row object when and in which direction to move the invaders in that row. The row object, in turn, moves each invader in that row, getting back the state of each one being on the edge or not. That state is then returned back to the world, which will then, if necessary, shift all invaders down and change the direction AFTER all rows have completed that sequence of moves.

6636 views / 1157 in the last 7 days

2 votes | 0 in the last 7 days

Tags: demo with-source invaders movement danpost

This scenario is a member of: Demos by danpost

open in greenfoot
Your browser does not support the canvas tag.
A new version of this scenario was uploaded on Wed Oct 30 08:41:41 UTC 2013 Added resetting of some fields when player is killed to keep invaders in line.


Do you mean you created an invisible row object that sits behind each row of invaders and detects each one and calls methods based on what is necessary?


Sorry about my lack of understanding I am very new to coding yet somehow made it to my second year at uni. It seems I have to become an expert programmer in like 8 days :/ lol.
A new version of this scenario was uploaded on 2016-03-19 04:41:05 UTC Source available.


game is trash dan


The top block in each column is the first to move so I can shoot and destroy blocks that aren't the lowest in the column. (It's possible there is nothing wrong with that, I've never seen the original of this game.)


with all due respect to danpost I don't like the way the 'aliens' don't move as a cohesive unit. I created my own version of this to show how I think the aliens should move. (which by the way I think is the way it works in the original). Link:


@Nosson1459, actually, they do not move a a whole group and the rows move with each other, but at slightly different times (in the original). Mine is wrong, however, in the order of row movement is botttom-up in the original, where I have it going top-down.

Want to leave a comment? You must first log in.

Who likes this?

data17 benskii93