Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

arrow_back Einen Blitzeinschlag zeichnen und animieren

Transcript

In this add-on, you’ll draw and program a user-controlled lightning bolt that moves from the sky to the ground. To begin, you’ll need to draw a lightning bolt.

Click “Paint new sprite.” Select “vector mode," as it’s generally easier to edit vector images. Click the paint brush, and choose a color and line width for your lightning. Then, create a lightning bolt! Don’t worry if it isn’t perfect. You can always go back and edit it later.

If you make a mistake while drawing, you can click the “undo” button at the top of the paint editor. Once you’ve created a lightning bolt, program it to move from the sky to the ground. First, program a starting position for the sprite. Drag the lightning bolt to a starting position at the top of the stage, then drag out a “go to” block from the motion menu. The x and y coordinates in the block will match the lightning bolt’s current position. So, if you move the sprite then click the block, the bolt will return to that starting position.

Now, the lightning bolt should glide towards the ground.

Drag the lightning bolt to where you’d like it to glide to.

Then, drag out a “glide for 1 second block,” and attach it below the “go to” block.

Click this block stack to try it. Great! Now the lightning starts at the top of the screen and glides to the bottom. Tinker with the time value in the “glide” block to get the lightning moving at a speed you like.

Click "events," and find an event to run this code. This example will use “when space key pressed,” but you can use any event you’d like for your story. Try it out!

Great, when the space key is pressed, the lightning moves. There are a few things that you can do now to make this look a little more realistic. Consider hiding the lightning after it moves down and showing it immediately after your event. Then, the sprite will hide between strikes.

You might also want to create a second costume for the lightning sprite, so it changes its appearance after it glides to look like it struck the ground.

Now, it’s your turn: 1) Click “paint new sprite.” 2) Paint a lightning bolt.

3) Select a starting position with a “go to” block.

4) Program the sprite to glide to a position. 5) Start your code with an event.

Then: Consider hiding the sprite between strikes and creating a second costume for when the sprite glides to the ground.

Erweiterung auswählen
Auf das Wetter reagieren
Die Figuren in eurer Geschichte so programmieren, dass sie auf den Blitz reagieren
Einen Blitzeinschlag zeichnen und animieren
Einen Blitz programmieren, der sich vom Himmel zum Boden bewegt
Die Szene wechseln
Eine zweite Szene für eure Regen-Geschichte programmieren
Donner hinzufügen
Donner- und Regenklänge in eurer Geschichte programmieren
Ein Erdbeben programmieren
Ein Erdbeben programmieren, das eure Geschichte erschüttert
Einen Regenbogen programmieren
Einen Regenbogen zeichnen und programmieren, der in eurer Regen-Geschichte erscheint
arrow_backward Zurück
Weiter arrow_forward
Anweisungen
  1. Wählt eine der Erweiterungen aus und schaut euch das Video an, um zu sehen, wie sie programmiert wird.
  2. Wenn ihr mit einer Erweiterung fertig seid, probiert eine andere aus!