The Triangle Space Invader Mac OS
Introduction
https://assistanterogon589.weebly.com/adobe-premiere-download-2018.html. All the machines feature original artwork of all-time iconic games. With immersive full-color hi-res displays and sounds, and full size joysticks and control buttons setup, you are looking at endless hours of gaming! Jump back to the 80's, grab the joystick and prepare your lasers with Arcade 1Up's Space Invaders countercade. Online 3d printing cad. Play Space Invaders for the NES in this awesome rom. Gorilla slot game. This rendition of Space Invaders has been updated from the original Atari version. New graphics and challenges await you. Oct 31, 2020 From the developer: Space Invaders Classic lets you play the classic old school arcade game of Space Invaders right in your Mac OS X Dashboard. You can use the arrow keys to control the ship, and press the space bar to shoot. The achieved score is displayed at the upper-left corner. The year is 2317. And they're back! https://bestzload375.weebly.com/free-slots-vegas-world.html. Bedlam 2 is the sequel to Bedlam. It's a Space Invaders kind of vertical shooter. Bedlam 2 features nice pre-rendered color sprite animations similar to other Mac shareware games in the.
This game is based very loosely on the classic early shootem-up game of Space Invaders. In this game there is only one alien, but if you want to make the game more complex you could duplicate the alien as many times as you wish.List of techniques
- Importing backgrounds
- Painting Sprites
- Keyboard input for moving sprites
- Random movement of a Sprite
- Duplicating Scripts
- Importing and playing sounds
- Sprite on Sprite collision detection
- Changing Sprite costumes in response to a collision
- Score variable
- Forever loop
- If loop
- Green Flag Scripts
Our first task is to provide a background for the game. We will import a readymade background - but we could draw our own. Once Scratch has loaded, click on the Stageicon in the Sprites List Area. Then click on the Backgrounds tab above the Script Area And then click the Import button | |
In the pop-up Import Backgroundwindow, double-click the Nature folder and then scroll down until you find the stars image file. Click this and then click OK | |
The Stage should now have a starry background. Our next task is to create a sprite which will become the laser cannon which we can move and fire to shoot at the aliens. Click the Paint new spritebutton above the Sprite List Area. | |
To keep things simple we will draw a triangle for our laser cannon (you could draw any shape you like). Click on the colour you want in the Colour Palette (I'm using a light green). Then click on the Line Drawtool on the Toolbar. On the canvas draw three lines to form a triangle (or any shape you wish) | |
Click on the Fill buckettool on the Toolbar. Click somewhere in the centre of the triangle shape to fill it with colour. If the paint leaks out and fills the whole screen, click the Undo button and use the paintbrush tool or line tool to close any gaps in the shape before filling it again. Then click the OK button | |
We'll now delete the Scratch the Cat sprite. We could have deleted it earlier (or later) or changed its shape. Right-click (Ctrl-click on a Mac) on the Sprite itself or its icon in the Sprite List Area. In the pop-up list click on delete. | |
If you feel your laser cannon is too large, you can shrink it by clicking on the Shrink Sprite button above the Stage Area and then clicking several times on the Sprite in the Stage Area. Next to the Shrink Spritebutton is the Grow Spritebutton which you can use if you accidentally shrink your Sprite too much. | |
Now we have created a Sprite, we can begin to program it. Click on the Control button above the Blocks Palette Area From the Blocks Palette Area, drag the when space key pressedblock into the Script Area | |
Click the drop down menu on the when space key pressedblock which you have just dragged into the Script Area From the drop down list, click on right arrow This tells the Script to do something when the right arrow key is pressed on the keyboard | |
Click the Motion button above the Blocks Palette From the Blocks Palette drag the point in direction 90block into the Script Area and attach it to the when right arrow key is pressed block Click the drop down menu on this block(ie on the 90) and from the list click on (90) right. It is not essential to do this as it is already set to point right. | |
From the Blocks Palette, drag the move 10 steps block into the Script Area and attach it below the point in direction 90block in your script You can now check how this script is working by pressing the right arrow on your keyboard. You can drag the Sprite back to the left if it reaches the edge of the screen. | |
textTo create a script for the left arrow key we could repeat the above steps. A quicker way is to duplicate the script we have just written and then change it. Right-click (Ctrl-click on a Mac) on the when right arrow key pressedblock and on the pop-up menu click duplicate | |
On the new script, change right arrow to left arrow in the when right arrow key pressed block Change the point in direction 90 block to read point in direction (-90) left You can now check these two scripts by pressing the left and right arrow keys to move your laser cannon across the bottom of the screen. | |
You will find that the cannon sprite flips upside down when travelling to the left. To prevent this click on the Only face left-rightbutton above the Script Area | text |
Now we need to create a laser bullet for the cannon to fire. Click the paint new spritebutton above the Sprite List Area (as in step 3). Click on the colour you would like to use (I'm using yellow) in the Colour Palette and then using either the Line Tool or the Paintbrush Tool, draw a short vertical line on the canvas. Then click OK. | |
We now need to write a script to control this Sprite. Click on the Control button above the Blocks Palette and from the Blocks Palette drag the when space key pressedblock into the Script Area. | |
First of all we must tell the bullet Sprite to go to the same place on the Stage as the laser cannon Sprite (ie Sprite 2). Click on the Motion button above the Blocks Palette and from the Blocks Palette drag the go to _ block into the Script Area and attach it below the when space key pressedblock. Click on the drop down menu on this block and then click on Sprite 2 in the menu | |
Now drag the point in direction 90block from the Blocks Palette into the Script Area and attach it beneath the go to Sprite 2 block Click on the drop down menu on this block (ie the 90) and from the menu select (0) up | |
From the Control Blocks Palette Area drag the repeat 10loop block into the Script Area and attach it beneath the point in direction 0block Change the 10 to 50 on the repeat block in the script by clicking in the pane, deleting the 10 and typing 50 | |
From the Motion Blocks Palette, drag the move 10 stepsblock into the Script Area and put it into the repeat 50 loop This tells the bullet to keep moving up the screen 10 steps, fifty times (ie a total of 500 steps). This is far more than is needed but it makes sure the bullet reaches the top of the screen. You can now test this Script by moving the cannon around with the arrow keys and firing the laser with the space bar. | |
It would be good if the laser cannon made a noise. So, click the Sounds tab above the Script Area and then click the Import button. We could record our own sound effect but this time we will use one which comes with the Scratch program | |
Double-click the Electronic folder to open it and then click on the Laser1sound file. Then click OK. | |
Click on the Scripts tab to show the Script for this Sprite From the Sound Blocks Palette, drag the play sound Laser1block into the Script Area and attach it beneath the point in direction 0block. It should insert itself if you drag the block to just below the point in direction 0 block. It doesn't matter if it is above the point in direction 0block as long as it isn't inside the repeat 50 loop otherwise the laser sound will play 50 times as it travels up the screen. Now when you press the space bar, your laser should make a sound when it is fired. | |
Now we need to make something for the laser to fire at. Press the paint a new spritebutton (as in Step 3 above) and then use the paint tools to create something alien-looking. It doesn't matter if you make it too large, you can always shrink it. Click the OK button when you are finished being creative. | |
Our alien Sprite needs two costumes: one its normal cuddly self and another showing it being blown-up after being hit by the laser bullet. Click on the Costumes tab above the Script Area for this Sprite and then click the Copy button | |
You will now get a copy of the Sprite's original costume (called costume 2). Click the Edit button for this new costume. | |
Use the paint tools to show a blown-up alien. Click OK when you are finished. | |
Now we need a Script for the Alien Sprite to move it around the screen and detect when it has been hit by the bullet. Click on the Scripts tab above the Scripts Area and from the Control Blocks Palette drag the when Green Flag clickedblock into the Script Area Then drag the Forever loop block from the Blocks Palette into the Script Area and attach it beneath the when Green Flag clickedblock. | |
From the Motion Blocks Palette, drag the go to x: _ y:_block into the Script Area and insert it into the Forever loop. | |
Change the co-ordinates in the go to x: _ y:_ block so the block now says go to x: 0 y: 110 Press the Green Flag button which is above the Stage Area on the right. If you try dragging the alien sprite around the stage it will keep shooting back to its (0,110) co-ordinate. Press the Red button next to the Green Flagbutton to stop all scripts from running. | |
The game would be extremely easy if every time the alien was shot it reappeared in the same location. We will now make it appear in a random place on the screen. From the Operators Block Palette, drag the pick random 1 to 10block into the go to x: 0 Y: 110 block to replace the 0 after x: Change the range of numbers in the pick randomblock so it reads pick random -200 to 200 | |
We will leave the y: value at 110 so it always appears the same distance away from the cannon each time (you could put another random block in the y: co-ordinate pane if you wish). From the Control Blocks Palette, drag the wait 1 secs block so it is inside the Forever loop below the go to x: pick random -200 to 200 y:110 block | |
We will now make it stay on the screen for a random amount of time, between 1 and 5 seconds, before moving to a new location. From the Operators Block Palette, drag the random 1 to 10block into the wait 1 secsblock in the Script Area to replace the 1 Change the range so the block now reads wait [pick random 1 to 5] secs You can now test this script by clicking on the Green Flag button. The alien should keep re-appearing at different locations after varying periods of time. Press the Red button when done. | |
The next stage is it detect when the bullet sprite hits and change the costume of the alien sprite. From the Control Blocks Palette, drag the If loopblock into the Script Area. For the moment there is no need to attach it to the script | |
From the Sensing Blocks Palette, drag the diamond-shaped touching _ ? block into the diamond shaped pane at the head of the Ifloopblock in the Script Area. Click the drop-down list on the touching _ ?block and from the list select Sprite 3 (ie the bullet Sprite) This instruction check if the alien sprite is touching the bullet sprite. | |
From the Looks Blocks Palette drag the switch to costumeblock into the Script Area and insert it into the main script just below the when Green Flag clickedblock. If necessary, change the block so its says switch to costume [costume1] Now drag the switch to costumeblock from the Blocks Palette and insert it into the If loop in the Script Area If necessary, change the block so it reads switch to costume [costume2] | |
Now to add a sound effect. Click the Sounds tab above the Script Area.Double-click the Electronic folder and then click on the Screech sound file. Now click the OK button | |
Click the Scripts tab above the Script Area to return to the script From the Sound Blocks Palette, drag the play sound Screech until doneblock into the Script Area and insert it into If loop after the switch to costume [costume2]block | |
From the Control Blocks Palette, drag the when Green Flagclicked block into the Script Area Now drag the Forever loop from the Blocks Palette and attach it to the when Green Flag clicked block | |
Drag the If loop into the Forever loop You can test this new Script by pressing the Green Flagbutton above the Stage Area You'll see that the problem is that when the alien re-appears at its next location it is still in its blown-up state (costume 2). After being hit we need the show the blown-up costume for a while (until the Screech sound ends) and then return the Alien Sprite to its original costume (costume 1) | |
From the Looks Blocks Palette, drag the switch to costume block into the Script Area and insert it into the If loop below the play sound Screech until doneblock If necessary, change the block so it reads switch to costume [costume1] | |
We can now do a bit of tidying-up. Drag the Forever loop block down from the switch to costume [costume1]block, and then remove the switch to costume [costume1]block by dragging it into the Blocks Palette Area Now drag the switch to costume [costume1] block from the If loop and insert it into the Forever loop above the go to x: pick random -200 to 200 y: 110 block Re-attach the Foreverloop block to the when Green Flag clickedblock | |
Last of all we need to add some sort of scoring system. Click on the Variables button and then the Make a variablebutton In the pop-up window, type Score as the variable name and then press OK | |
Drag the set score to 0 block into the Script Area and insert it into the lower of the two Scripts just below the when Green Flag clicked block Now drag the change Score by 1 into the Script Area and insert it into the If loop (anywhere in the loop will do) | |
To give the player time to see the effect of their successful shot, drag the wait 1 secs block from the Control Blocks Palette Area to the Script Area and insert it into the Ifloop below the change Score by 1block | |
To make the game a little more challenging, let's add a Script to enable the Alien Sprite to fire at the Laser Cannon Sprite. Click on the Paint new spritebutton and create an alien-looking laser bolt. You could duplicate the existing laser bullet sprite (Sprite 3) to save time but you will then need to edit the script for the new laser bolt sprite. | |
By now you could probably create your own Script for the Alien laser bolt Sprite. Here is a simple Script you could use. Alternatively, you might want to add a random waitblock at the start of the forever loop | |
You will also need to create a blown-up costume for the Laser Cannon Sprite and add to its Script to detect and respond when it is hit by the Alien's Laser Bolt Sprite - here is one example of how the script can be modified. |
Space Invader Emoji
Extensions
- You could add a variable to decrease the number of lives each time the Laser Cannon Sprite has been hit.
- You could add a variable to show a High Score
- You could increase the number of aliens (simply duplicate the Alien Sprite)
- You could improve the procedure for the Alien Sprite to make it move across and down the screen as in the original version of the game
- importos
- importrandom
- #Set up the screen wn means window
- wn.bgcolor('black')
- #wn.bgpic('space_invaders_background.gif')
- #Register the shapes (in order to change their image)
- #turtle.register_shape('player.gif')
- #Draw Border
- border_pen.speed(0)
- border_pen.penup()
- border_pen.pendown()
- for side inrange(4):
- border_pen.lt(90)
- score =0
- #Draw the score on screen
- score_pen.speed(0)
- score_pen.penup()
- scorestring ='Score: %s' %score
- score_pen.write(scorestring,False, align='left', font=('Arial',24,'normal'))
- player =turtle.Turtle()
- player.shape('triangle')
- player.speed(0)
- player.setheading(90)
- playerspeed =15#moves 15 pixels each time left or right
- #Choose a number of enemies
- #Create an empty list of enemies
- for i inrange(number_of_enemies):
- enemies.append(turtle.Turtle())
- for enemy in enemies:
- enemy.shape('circle')
- enemy.speed(0)
- y =random.randint(100,250)
- bullet =turtle.Turtle()
- bullet.shape('triangle')
- bullet.speed(0)
- bullet.shapesize(0.5,0.5)
- #ready - ready to fire
- bulletstate ='ready'
- def move_left():
- x -= playerspeed
- x = -280
- x = player.xcor()
- if x >280:
- player.setx(x)
- #Declare bulletstate as a global if it needs changed
- global bulletstate #means any change to bullet in code affects rest of code
- #os.system('afplay laser.wav&')
- #Move the bullet to just above the player
- y = player.ycor() +10
- bullet.showturtle()
- def isCollision(t1, t2):
- distance =math.sqrt(math.pow(t1.xcor()-t2.xcor(),2)+math.pow(t1.ycor()-t2.ycor(),2))
- returnTrue
- returnFalse
- turtle.listen()
- turtle.onkey(move_right,'Right')
- loop =True
- for enemy in enemies:
- x = enemy.xcor()
- enemy.setx(x)
- #Move the enemy back and down
- #Moves all enemies down
- y = e.ycor()
- e.sety(y)
- enemyspeed *= -1
- if enemy.xcor()< -280:
- for e in enemies:
- y -=40
- #Change enemy direction
- player.hideturtle()
- print('Game Over')
- #Check for a collision between the bullet and the enemy
- #os.system('afplay explosion.wav&')
- bullet.hideturtle()
- bullet.setposition(0, -400)
- x =random.randint(-200,200)
- enemy.setposition(x, y)
- score +=10
- score_pen.clear()
- score_pen.write(scorestring,False, align='left', font=('Arial',14,'normal'))
- #Move the bullet
- y = bullet.ycor()
- bullet.sety(y)
- #Check to see if the bullet has reached the top
- bullet.hideturtle()