Discuss Scratch

breenworks
Scratcher
15 posts

Space Invader Issues

I am trying to create the classic arcade shooter within Scratch 2.0 with all vector graphics. Currently stuck on how to get invaders to reverse direction when they reach the edge of the screen. I created a variable which should toggle between 1 and 0 whenever any alien reaches the edge of the screen. But checking the X position doesn't seem to be working (i.e. when X>250 set direction to 0). Any ideas?

I also tried creating lines down each side of the screen then toggling when aliens collide with bars, but the collision didn't seem to work.

I've shared the project so the code would be viewable:

http://beta.scratch.mit.edu/projects/10013659/
1st_scratcher
Scratcher
100+ posts

Space Invader Issues

breenworks wrote:

I am trying to create the classic arcade shooter within Scratch 2.0 with all vector graphics. Currently stuck on how to get invaders to reverse direction when they reach the edge of the screen. I created a variable which should toggle between 1 and 0 whenever any alien reaches the edge of the screen. But checking the X position doesn't seem to be working (i.e. when X>250 set direction to 0). Any ideas?

I also tried creating lines down each side of the screen then toggling when aliens collide with bars, but the collision didn't seem to work.

I've shared the project so the code would be viewable:

http://beta.scratch.mit.edu/projects/10013659/
the max for x is 240 so say when
x > 239
x < -239
everybodyedits
Scratcher
9 posts

Space Invader Issues

breenworks wrote:

I am trying to create the classic arcade shooter within Scratch 2.0 with all vector graphics. Currently stuck on how to get invaders to reverse direction when they reach the edge of the screen. I created a variable which should toggle between 1 and 0 whenever any alien reaches the edge of the screen. But checking the X position doesn't seem to be working (i.e. when X>250 set direction to 0). Any ideas?

I also tried creating lines down each side of the screen then toggling when aliens collide with bars, but the collision didn't seem to work.

I've shared the project so the code would be viewable:

http://beta.scratch.mit.edu/projects/10013659/
You did not share the project.

Hello!
Rick3137
Scratcher
13 posts

Space Invader Issues

I fixed your program. Took all morning. I used alot of local variables and replaced alot of old blocks that may have went bad,


http://beta.scratch.mit.edu/projects/10048479/#player
breenworks
Scratcher
15 posts

Space Invader Issues

Wow, thank you for giving the game your time and careful attention. I learned some new tricks by reviewing your code!
Rick3137
Scratcher
13 posts

Space Invader Issues

Your welcome. Let me know when you get another one your stuck on.
breenworks
Scratcher
15 posts

Space Invader Issues

I ended up breaking through a few more mental barriers, finally wrapped my head around clone advantages and discovered the missing link: broadcasting! Now I have a much more functional Invaders game that just needs some sound effects to evoke that 1970's coin-op vibe!

Play/remix Scratch Invaders
sizzle01
New to Scratch
1 post

Space Invader Issues

I have tried to make an invaders game on scratch using a tutorial http://www.eastonhome.co.uk
/Scratch/index.htm
i have got to the stage were i am stuck on The barriers i can not get the laser to disapear when it hits the barrier… could someone have a look at the link above click on invaders watch how the process goes and tell me how to get the laser to disappear as soon as it hits the barrier thanks
mwiedmann
Scratcher
100+ posts

Space Invader Issues

Cool game. Looks great.

It was very laggy for me though. Removing the “invader-chk” play sound block helped a lot. You have that playing on each clone so that is really killing performance. After taking it out it ran a little better but still was a bit laggy. I removed the bottom row of invaders and then it ran super smooth. Performance will obviously vary depending on your machine and browser but you might want to test it out on a few setups before your final release to see how it runs. One thing that may help a little would be to put a small delay in the invaders. In the original space invaders the aliens kind of jumped a few pixels at a time rather than smoothly gliding. If you put a small delay and a bigger move, you would get that effect and performance may improve slightly since the delay will allow Scratch to attend to other sprites.

Very cool though!

Powered by DjangoBB