
-----------------------------------
ashlyn10
Fri Jan 18, 2013 11:06 pm

How Do You Make The Spaceship Shoot The Asteroid Need Help Due Monday Grade 11 Summutive
-----------------------------------
this is my grade 11 summitave for computer science and i do not really understand the class at all, we use the program turing.  This is my game so far, how do i make the ship shoot a mistle at the asteroiods? help please!!

var font1 : int := Font.New ("serif:124")
var font2 : int := Font.New ("serif:20")
var font3 : int := Font.New ("Serif:20")
var font4 : int := Font.New ("Serif:20")
var mousex : int
var mousey : int
var button : int
var asteroid : int := Pic.FileNew("asteroid.jpg")
var asteroid3 : int := Pic.FileNew("asteroid3.jpg")


% This is the background
setscreen ("graphics")
colourback (black)
cls
color (17)

% This is what is on the main screen
procedure mainscreen
    Font.Draw ("Asteriods", 10, 190, font1, white)
    Font.Draw ("Play Game", 230, 100, font2, white)
    Font.Draw ("Instructions", 230, 70, font4, white)
    Font.Draw ("High Scores", 230, 40, font3, white)
end mainscreen

procedure playgame
    var ship : int := Pic.FileNew ("ship.gif")
    View.Set ("graphics:300;250),nobuttonbar")
    var pic : array 0 .. 35 of int
    const CTR : int := 48
    pic (0) := ship
    cls
    for angle : 1 .. 35
        pic (angle) := Pic.Rotate (pic (0), angle * 10, CTR, CTR)
    end for
    var angle : int :=0
    var x : int := 300
    var y : int := 300
    var chars : array char of boolean
    loop
        Input.KeyDown (chars)
        if chars (KEY_RIGHT_ARROW) then
            if angle > 0 then
                angle := angle - 1
            else
                angle := 35
            end if
        end if
        if chars (KEY_LEFT_ARROW) then
            if angle < 35 then
                angle := angle + 1
            else
                angle := 0
            end if
        end if
         if chars (KEY_UP_ARROW) then
           x := x+round (2*sind(10*angle))
            y := y+round (2*cosd(10*angle))
        end if
         if chars (KEY_DOWN_ARROW) then
            if angle > 0 then
                angle := angle - 1
            else
                angle := 35
            end if
        end if
Pic.Draw (pic (angle), x, y, picMerge)
Pic.Draw (asteroid, 30, 40, picMerge)
Pic.Draw (asteroid3,420, 90, picMerge)
Pic.Draw (asteroid,120, 336, picMerge)
        delay (50)
        cls

    end loop
    cls
    Pic.Draw (ship, 270, 160, picMerge)
    delay (1000)
end playgame

% This is the instructions to the game
procedure instructions
    cls
    colour (white)
    put "Welcome to Asteroids.The object of this game is to destroy all of the asteriods."
    put "while trying to avoid being hit.As you adavance to the next levels, the amount"
    put "of points you get for each destroyed asteroid will increase."
    put "Good luck,enjoy the game and have fun!"
    put "Controls"
    put "Up arrow makes you accelerate"
    put "Down arrow makes you decelerate"
    put "Left arrow makes you turn to the left"
    put "Right arrow makes you turn to the right"
    put "Space bar makes you shoot a bullet"
    put "Press any key to continue.."
    Input.Pause
    cls
    mainscreen
end instructions










mainscreen

% If play game is selected
loop
    Mouse.Where (mousex, mousey, button)
    if mousex > 230 and mousex < 350 and mousey > 100 and mousey < 125 and button = 1 then
        playgame
    elsif
            mousex > 230 and mousex < 350 and mousey > 70 and mousey < 95 and button = 1 then
        instructions
    end if
end loop

-----------------------------------
Raknarg
Sat Jan 19, 2013 12:09 am

RE:How Do You Make The Spaceship Shoot The Asteroid Need Help Due Monday Grade 11 Summutive
-----------------------------------
If you really just don't understand what you're doing, the best thing to do is to switch to an easier project. I don't mind teaching concepts, but not just to help someone slap together a last minute game.

-----------------------------------
ashlyn10
Sat Jan 19, 2013 2:23 pm

RE:How Do You Make The Spaceship Shoot The Asteroid Need Help Due Monday Grade 11 Summutive
-----------------------------------
we cant switch games the teacher assigned us a game and he said all i need to do now is get the ship to shoot bullets.

-----------------------------------
Tony
Sat Jan 19, 2013 4:47 pm

RE:How Do You Make The Spaceship Shoot The Asteroid Need Help Due Monday Grade 11 Summutive
-----------------------------------
Alright. So you've skipped the standard questions of:

What problem are you having?
What have you already tried doing to solve that problem?

-----------------------------------
SAValkyrie
Sun Jan 20, 2013 11:01 am

Re: How Do You Make The Spaceship Shoot The Asteroid Need Help Due Monday Grade 11 Summutive
-----------------------------------
For the bullet shooting, you can set a process.

Such as 


process bulletshooting (x, y : int)
 % Collision detection here
if distance_of_whatever 