Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this add-on, you’ll make the hero shoot a laser to zap the bugs!
First, click paint new sprite, and draw a laser for your game.
This example draws a small, filled-in, red rectangle.
Program the laser’s motion.
It should start at the hero, then shoot forward.
So, the first block is the second “go to” block, the one with the dropdown.
Drag it out, then select “Hero” from the dropdown.
Make the laser shoot out once it’s at the hero.
Snap a “repeat until” loop from the “control” below the “go to” block.
The laser will repeat moving forward until it touches the edge.
From “sensing,” drag a “touching” block into the loop’s condition space, and
Then, from “motion,” place a “change x” block inside the loop.
Click to test!
The laser shoots across the stage!
But, it gets stuck once it gets to the edge.
To make it disappear, add a “hide” block.
That means you need a “show” block at the beginning to make it show again!
That looks more like a laser.
Finally, make your laser look even fancier.
From the “pen” menu, drag a “stamp” block into the “repeat until” loop.
Click and see what happens.
That’s pretty cool.
Now, get rid of all these stamps when you hide the laser.
Drag a “clear” block below the loop.
Add an event to the top!
The “when space key pressed” event works nicely.
Now, it’s your turn.
Paint a laser sprite.
Make it go to the hero.
Shoot it with a repeat until loop.
Show, hide, stamp, and clear to get all the visuals right.