Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 SPACE INVADERS help
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
faulkner16




PostPosted: Mon May 19, 2008 2:06 pm   Post subject: SPACE INVADERS help

K, so im workin on space invaders, and i need some help.. yes im a noob, i didnt use arrays, but in that sense, its working fine, i need help with the enemies shooting. when the enemies shoot, it displays the circle fine, but it never detects hitting the ship, and when i press shoot , the ship's bullet moves fine, but the enemies bullet moves extra slow...

could anyone help me with this?
also, if you can, give me some advice on how to put this all in arrays, but im not too concerned about this
thanks:)




Turing:


View.Set ("offscreenonly")

var chars : array char of boolean
var x, y, bullety, bulletx : int := 100
var shot : int := 0
var mypic : int := Pic.FileNew ("spaceship2.jpg")
var mypic7 : int := Pic.FileNew ("instructions.jpg")
var mypic8 : int := Pic.FileNew ("backgroundstarsbam.jpg")
var score, highscore : int := 0

var y1, y2 : int
var z, enemybxz : int := 100
var enemyby : int := 250
var enemyshot : int := 0
var p : int

var hitleftwall, hitrightwall, firedelay, firedelaytime, totalfired, statsenemy : int := 0
var enemy1, enemy2, enemy3, enemy4, enemy5, enemy6, enemy7, enemy8, enemy9, enemy10, enemy11, enemy12, enemy13, enemy14, enemy15, enemy16, enemy17, enemy18, enemy19, enemy20, enemy21, enemy22, enemy23, enemy24, enemy25, enemy26, enemy27, enemy28, enemy29, enemy30, enemy31, enemy32, enemy33, enemy34, enemy35, enemy36, enemy37, enemy38, enemy39, enemy40, enemy41, enemy42 : int
var enemy1hp, enemy2hp, enemy3hp, enemy4hp, enemy5hp, enemy6hp, enemy7hp, enemy8hp, enemy9hp, enemy10hp, enemy11hp, enemy12hp, enemy13hp, enemy14hp, enemy15hp, enemy16hp, enemy17hp, enemy18hp, enemy19hp, enemy20hp, enemy21hp, enemy22hp, enemy23hp, enemy24hp, enemy25hp, enemy26hp, enemy27hp, enemy28hp, enemy29hp, enemy30hp, enemy31hp, enemy32hp, enemy33hp, enemy34hp, enemy35hp, enemy36hp, enemy37hp, enemy38hp, enemy39hp, enemy40hp, enemy41hp, enemy42hp: int
var lazerx, lazery, fired : array 1 .. 10 of int
var enemyhp, enemyx,special, enemyy : int
var choice2 : string
choice2 := "q"

var enemyxmov, enemyymov : int
var shiphp : int :=3
var mypic2 : int := Pic.FileNew ("enemy.jpg")
var mypic3 : int := Pic.FileNew ("enemy2.jpg")
var mypic4 : int := Pic.FileNew ("enemy3.jpg")
var mypic5 : int := Pic.FileNew ("bomb.jpg")
var continue : string
var flag, font, w, l  : int
var diameter : int
diameter := 25
var bombs : int
bombs := 100
y1 := 25
y2 := 30
enemyxmov := 100
enemyymov := 400

enemy1 := 1
enemy2 := 1
enemy3 := 1
enemy4 := 1
enemy5 := 1
enemy6 := 1
enemy7 := 1
enemy8 := 1
enemy9 := 1
enemy10 := 1
enemy11 := 1
enemy12 := 1
enemy13 := 1
enemy14 := 1
enemy15 := 1
enemy16 := 1
enemy17 := 1
enemy18 := 1
enemy19 := 1
enemy20 := 1
enemy21 := 1
enemy22 := 1
enemy23 := 1
enemy24 := 1
enemy25 := 1
enemy26 := 1
enemy27 := 1
enemy28 := 1
enemy29 := 1
enemy30 := 1
enemy31 := 1
enemy32 := 1
enemy33 := 1
enemy34 := 1
enemy35 := 1
enemy36 := 1
enemy37 := 1
enemy38 := 1
enemy39 := 1
enemy40 := 1
enemy41 := 1
enemy42 := 1

special := 0
flag := 0
enemy1hp := 3
enemy2hp := 3
enemy3hp := 3
enemy4hp := 3
enemy5hp := 3
enemy6hp := 3
enemy7hp := 3
enemy8hp := 3
enemy9hp := 3
enemy10hp := 3
enemy11hp := 3
enemy12hp := 3
enemy13hp := 3
enemy14hp := 3
enemy15hp := 3
enemy16hp := 3
enemy17hp := 3
enemy18hp := 3
enemy19hp := 3
enemy20hp := 3
enemy21hp := 3
enemy22hp := 3
enemy23hp := 3
enemy24hp := 3
enemy25hp := 3
enemy26hp := 3
enemy27hp := 3
enemy28hp := 3
enemy29hp := 3
enemy30hp := 3
enemy31hp := 3
enemy32hp := 3
enemy33hp := 3
enemy34hp := 3
enemy35hp := 3
enemy36hp := 3
enemy37hp := 3
enemy38hp := 3
enemy39hp := 3
enemy40hp := 3
enemy41hp := 3
enemy42hp := 3
% enemy check
procedure enemymov

for g : 1..524
enemyymov := enemyymov - 1




end for



end enemymov

procedure bomb
randint (p, 1, 3)
if p = 1 then
enemy2 := 0
enemy5 := 0
enemy17 := 0
enemy34 := 0
enemy29 := 0
enemy25 := 0
enemy41 := 0
elsif p = 2 then
enemy1 := 0
enemy8 := 0
enemy13 := 0
enemy36 := 0
enemy21 := 0
enemy27 := 0
enemy39 := 0
elsif p = 3 then
enemy3 := 0
enemy9 := 0
enemy15 := 0
enemy32 := 0
enemy28 := 0
enemy22 := 0
enemy40 := 0
enemy24 := 0
end if
end bomb
procedure shootlazer






if enemy1 = 1 then
    if bulletx >= 83 and bulletx <= 111 and bullety = 402 then
        enemy1hp := enemy1hp - 1
       
 bullety := 700
        bulletx := x
        score := score + 10

        if enemy1hp = 0 then
            enemy1 := 0
            score := score + 20

        end if
        end if
        end if
if enemy2 = 1 then
    if bulletx > 137 and bulletx < 163 and bullety = 402 then
        enemy2hp := enemy2hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy2hp = 0 then
            enemy2 := 0
              score := score + 20
        end if
         end if
        end if
if enemy3 = 1 then
    if bulletx > 184 and bulletx < 214 and bullety = 402 then
        enemy3hp := enemy3hp - 1

 bullety := 700
        bulletx := x
        score := score + 10
        if enemy3hp = 0 then
            enemy3 := 0
              score := score + 20
        end if
         end if
        end if
if enemy4 = 1 then
    if bulletx > 237 and bulletx < 263 and bullety = 402 then
        enemy4hp := enemy4hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy4hp = 0 then
            enemy4 := 0
              score := score + 20
        end if
         end if
        end if
if enemy5 = 1 then
    if bulletx > 287 and bulletx < 313 and bullety = 402 then
        enemy5hp := enemy5hp - 1
 bullety :=  700
        bulletx := x
        score := score + 10
        if enemy5hp = 0 then
            enemy5 := 0
              score := score + 20
        end if
         end if
        end if
if enemy6 = 1 then
    if bulletx > 337 and bulletx < 363 and bullety = 402 then
        enemy6hp := enemy6hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy6hp = 0 then
            enemy6 := 0
              score := score + 20
        end if
         end if
        end if
if enemy7 = 1 then
    if bulletx > 387 and bulletx < 413 and bullety = 402 then
        enemy7hp := enemy7hp - 1

 bullety := 700
        bulletx := x
        score := score + 10
        if enemy7hp = 0 then
            enemy7 := 0
              score := score + 20
        end if
         end if
        end if
if enemy8 = 1 then
    if bulletx > 437 and bulletx < 463 and bullety = 402 then
        enemy8hp := enemy8hp - 1
 bullety :=  700
        bulletx := x
score := score + 10
        if enemy8hp = 0 then
            enemy8 := 0
              score := score + 20
        end if
         end if
        end if
if enemy9 = 1 then
    if bulletx > 487 and bulletx < 513 and bullety = 402 then
        enemy9hp := enemy9hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy9hp = 0 then
            enemy9 := 0
              score := score + 20
        end if
         end if
        end if
if enemy10 = 1 then
    if bulletx > 537 and bulletx < 563 and bullety = 402 then
        enemy10hp := enemy10hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy10hp = 0 then
            enemy10 := 0
              score := score + 20
        end if
         end if
        end if
if enemy11 = 1 then
    if bulletx > 587 and bulletx < 613 and bullety = 402 then
        enemy11hp := enemy11hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy11hp = 0 then
            enemy11 := 0
              score := score + 20
        end if
         end if
        end if
if enemy12 = 1 then
    if bulletx > 637 and bulletx < 663 and bullety = 402 then
        enemy12hp := enemy12hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy12hp = 0 then
            enemy12 := 0
              score := score + 20
 
           end if
            end if
        end if
           if enemy13 = 1 then
    if bulletx > 687 and bulletx < 713 and bullety = 402 then
        enemy13hp := enemy13hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy13hp = 0 then
            enemy13 := 0
              score := score + 20
        end if
         end if
        end if
if enemy14 = 1 then
    if bulletx > 737 and bulletx < 763 and bullety = 402 then
        enemy14hp := enemy14hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy14hp = 0 then
            enemy14 := 0
              score := score + 20
        end if
    end if
     end if
     
if enemy15 = 1 then
    if bulletx >= 83 and bulletx <= 111 and bullety = 352 then
        enemy15hp := enemy15hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy15hp = 0 then
            enemy15 := 0
              score := score + 20

        end if
         end if
        end if
if enemy16 = 1 then
    if bulletx > 137 and bulletx < 163 and bullety = 352 then
        enemy16hp := enemy16hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy16hp = 0 then
            enemy16 := 0
              score := score + 20
        end if
         end if
        end if
if enemy17 = 1 then
    if bulletx > 184 and bulletx < 214 and bullety = 352 then
        enemy17hp := enemy17hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy17hp = 0 then
            enemy17 := 0
              score := score + 20
        end if
         end if
        end if
if enemy18 = 1 then
    if bulletx > 237 and bulletx < 263 and bullety = 352 then
        enemy18hp := enemy18hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy18hp = 0 then
            enemy18 := 0
              score := score + 20
        end if
         end if
        end if
if enemy19 = 1 then
   if bulletx > 287 and bulletx < 313 and bullety = 352 then
        enemy19hp := enemy19hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy19hp = 0 then
            enemy19 := 0
              score := score + 20
        end if
         end if
        end if
if enemy20 = 1 then
    if bulletx > 337 and bulletx < 363 and bullety = 352 then
        enemy20hp := enemy20hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy20hp = 0 then
            enemy20 := 0
              score := score + 20
        end if
         end if
        end if
if enemy21 = 1 then
    if bulletx > 387 and bulletx < 413 and bullety = 352 then
        enemy21hp := enemy21hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy21hp = 0 then
            enemy21 := 0
              score := score + 20
        end if
         end if
        end if
if enemy22 = 1 then
    if bulletx > 437 and bulletx < 463 and bullety = 352 then
        enemy22hp := enemy22hp - 1

 bullety := 700
        bulletx := x
        score := score + 10
        if enemy22hp = 0 then
            enemy22 := 0
              score := score + 20
        end if
         end if
        end if
if enemy23 = 1 then
    if bulletx > 487 and bulletx < 513 and bullety = 352 then
        enemy23hp := enemy23hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy23hp = 0 then
            enemy23 := 0
              score := score + 20
        end if
         end if
        end if
if enemy24 = 1 then
    if bulletx > 537 and bulletx < 563 and bullety = 352 then
        enemy24hp := enemy24hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy24hp = 0 then
            enemy24 := 0
              score := score + 20
        end if
         end if
        end if
if enemy25 = 1 then
    if bulletx > 587 and bulletx < 613 and bullety = 352 then
        enemy25hp := enemy25hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy25hp = 0 then
            enemy25 := 0
              score := score + 20
        end if
         end if
        end if
if enemy26 = 1 then
    if bulletx > 637 and bulletx < 663 and bullety = 352 then
        enemy26hp := enemy26hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy26hp = 0 then
            enemy26 := 0
              score := score + 20
      end if
       end if
        end if
      if enemy27 = 1 then
    if bulletx > 687 and bulletx < 713 and bullety = 352 then
        enemy27hp := enemy27hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy27hp = 0 then
            enemy27 := 0
              score := score + 20
        end if
        end if
        end if
if enemy28 = 1 then
    if bulletx > 737 and bulletx < 763 and bullety = 352 then
        enemy28hp := enemy28hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy28hp = 0 then
            enemy28 := 0
              score := score + 20
        end if
    end if
     end if
   
 if enemy29 = 1 then   
    if bulletx >= 83 and bulletx <= 111 and bullety = 302 then
        enemy29hp := enemy29hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy29hp = 0 then
            enemy29 := 0
              score := score + 20

        end if
         end if
        end if
if enemy30 = 1 then
    if bulletx > 137 and bulletx < 163 and bullety = 302 then
        enemy30hp := enemy30hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy30hp = 0 then
            enemy30 := 0
              score := score + 20
        end if
         end if
        end if
if enemy31 = 1 then
    if bulletx > 184 and bulletx < 214 and bullety = 302 then
        enemy31hp := enemy31hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy31hp = 0 then
            enemy31 := 0
              score := score + 20
        end if
         end if
        end if
if enemy32 = 1 then
    if bulletx > 237 and bulletx < 263 and bullety = 302 then
        enemy32hp := enemy32hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy32hp = 0 then
            enemy32 := 0
              score := score + 20
        end if
         end if
        end if
if enemy33 = 1 then
    if bulletx > 287 and bulletx < 313 and bullety = 302 then
        enemy33hp := enemy33hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy33hp = 0 then
            enemy33 := 0
              score := score + 20
        end if
         end if
        end if
if enemy34 = 1 then
    if bulletx > 337 and bulletx < 363 and bullety = 302 then
        enemy34hp := enemy34hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy34hp = 0 then
            enemy34 := 0
              score := score + 20
        end if
         end if
        end if
if enemy35 = 1 then
    if bulletx > 387 and bulletx < 413 and bullety = 302 then
        enemy35hp := enemy35hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy35hp = 0 then
            enemy35 := 0
              score := score + 20
        end if
         end if
        end if
if enemy36 = 1 then
    if bulletx > 437 and bulletx < 463 and bullety = 302 then
        enemy36hp := enemy36hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy36hp = 0 then
            enemy36 := 0
              score := score + 20
        end if
         end if
        end if
if enemy37 = 1 then
    if bulletx > 487 and bulletx < 513 and bullety = 302 then
        enemy37hp := enemy37hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy37hp = 0 then
            enemy37 := 0
              score := score + 20
        end if
         end if
        end if
if enemy38 = 1 then
    if bulletx > 537 and bulletx < 563 and bullety = 302 then
        enemy38hp := enemy38hp - 1
 bullety := 700
        bulletx := x
score := score + 10
        if enemy38hp = 0 then
            enemy38 := 0
              score := score + 20
        end if
         end if
        end if
if enemy39 = 1 then
    if bulletx > 587 and bulletx < 613 and bullety = 302 then
        enemy39hp := enemy39hp - 1
 bullety := 700
        bulletx := x
        if enemy39hp = 0 then
            enemy39 := 0
              score := score + 20
        end if
         end if
        end if
if enemy40 = 1 then
    if bulletx > 637 and bulletx < 663 and bullety = 302 then
        enemy40hp := enemy40hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy40hp = 0 then
            enemy40 := 0
              score := score + 20
        end if
         end if
        end if
        if enemy41 = 1 then
    if bulletx > 687 and bulletx < 713 and bullety = 302 then
        enemy41hp := enemy41hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy41hp = 0 then
            enemy41 := 0
              score := score + 20
        end if
         end if
        end if
if enemy42 = 1 then
    if bulletx > 737 and bulletx < 763 and bullety = 302 then
        enemy42hp := enemy42hp - 1
 bullety := 700
        bulletx := x
        score := score + 10
        if enemy42hp = 0 then
            enemy42 := 0
              score := score + 20
        end if
    end if
     end if





end shootlazer

procedure shiphealth
if enemybxz > x  and enemybxz < x + 50 and enemyby = 50 then
shiphp := shiphp - 1
enemybxz := 100
enemyby := 250
 
if shiphp = 0 then
 font := Font.New ("serif:40")
Draw.Text ("Game Over", maxx div 2 - 140, 450, font, red)
end if
end if
end shiphealth
% enemy procedure
procedure enemyproc
    if enemy1 = 1 then
   
        if enemy1hp = 3 then
            Pic.Draw (mypic2, enemyxmov, enemyymov, 0)
        elsif enemy1hp = 2 then
            Pic.Draw (mypic3, enemyxmov, enemyymov, 0)
        elsif enemy1hp = 1 then
            Pic.Draw (mypic4, enemyxmov, enemyymov, 0)
       
            end if
       
    end if



    if enemy2 = 1 then



        if enemy2hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 50, enemyymov, 0)
        elsif enemy2hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 50, enemyymov, 0)
        elsif enemy2hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 50, enemyymov, 0)
        end if
    end if



    if enemy3 = 1 then
        if enemy3hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 100, enemyymov, 0)
        elsif enemy3hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 100, enemyymov, 0)
        elsif enemy3hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 100, enemyymov, 0)
        end if
    end if


    if enemy4 = 1 then
        if enemy4hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 150, enemyymov, 0)
        elsif enemy4hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 150, enemyymov, 0)
        elsif enemy4hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 150, enemyymov, 0)
        end if
    end if



    if enemy5 = 1 then
        if enemy5hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 200, enemyymov, 0)
        elsif enemy5hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 200, enemyymov, 0)
        elsif enemy5hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 200, enemyymov, 0)
        end if
    end if



    if enemy6 = 1 then
        if enemy6hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 250, enemyymov, 0)
        elsif enemy6hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 250, enemyymov, 0)
        elsif enemy6hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 250, enemyymov, 0)
        end if
    end if

    if enemy7 = 1 then
        if enemy7hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 300, enemyymov, 0)
        elsif enemy7hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 300, enemyymov, 0)
        elsif enemy7hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 300, enemyymov, 0)
        end if
    end if


    if enemy8 = 1 then
        if enemy8hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 350, enemyymov, 0)
        elsif enemy8hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 350, enemyymov, 0)
        elsif enemy8hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 350, enemyymov, 0)
        end if
    end if


    if enemy9 = 1 then
        if enemy9hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 400, enemyymov, 0)
        elsif enemy9hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 400, enemyymov, 0)
        elsif enemy9hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 400, enemyymov, 0)
        end if
    end if


    if enemy10 = 1 then
        if enemy10hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 450, enemyymov, 0)
        elsif enemy10hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 450, enemyymov, 0)
        elsif enemy10hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 450, enemyymov, 0)
        end if
    end if

    if enemy11 = 1 then
        if enemy11hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 500, enemyymov, 0)
        elsif enemy11hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 500, enemyymov, 0)
        elsif enemy11hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 500, enemyymov, 0)
        end if
    end if



    if enemy12 = 1 then
        if enemy12hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 550, enemyymov, 0)
        elsif enemy12hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 550, enemyymov, 0)
        elsif enemy12hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 550, enemyymov, 0)
        end if
    end if

   
    if enemy13 = 1 then
        if enemy13hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 600, enemyymov, 0)
        elsif enemy13hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 600, enemyymov, 0)
        elsif enemy13hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 600, enemyymov, 0)
        end if
    end if
   
    if enemy14 = 1 then
        if enemy14hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 650, enemyymov, 0)
        elsif enemy14hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 650, enemyymov, 0)
        elsif enemy14hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 650, enemyymov, 0)
        end if
    end if

    if enemy15 = 1 then
        if enemy15hp = 3 then
            Pic.Draw (mypic2, enemyxmov, enemyymov - 50, 0)
        elsif enemy15hp = 2 then
            Pic.Draw (mypic3, enemyxmov, enemyymov - 50, 0)
        elsif enemy15hp = 1 then
            Pic.Draw (mypic4, enemyxmov, enemyymov - 50, 0)
        end if
    end if



    if enemy16 = 1 then



        if enemy16hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 50, enemyymov - 50, 0)
        elsif enemy16hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 50, enemyymov - 50, 0)
        elsif enemy16hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 50, enemyymov - 50, 0)
        end if
    end if



    if enemy17 = 1 then
        if enemy17hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 100, enemyymov - 50, 0)
        elsif enemy17hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 100, enemyymov - 50, 0)
        elsif enemy17hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 100, enemyymov - 50, 0)
        end if
    end if


    if enemy18 = 1 then
        if enemy18hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 150, enemyymov - 50, 0)
        elsif enemy18hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 150, enemyymov - 50, 0)
        elsif enemy18hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 150, enemyymov - 50, 0)
        end if
    end if



    if enemy19 = 1 then
        if enemy19hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 200, enemyymov - 50, 0)
        elsif enemy19hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 200, enemyymov - 50, 0)
        elsif enemy19hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 200, enemyymov - 50, 0)
        end if
    end if



    if enemy20 = 1 then
        if enemy20hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 250, enemyymov - 50, 0)
        elsif enemy20hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 250, enemyymov - 50, 0)
        elsif enemy20hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 250, enemyymov - 50, 0)
        end if
    end if

    if enemy21 = 1 then
        if enemy21hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 300, enemyymov - 50, 0)
        elsif enemy21hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 300, enemyymov - 50, 0)
        elsif enemy21hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 300, enemyymov - 50, 0)
        end if
    end if


    if enemy22 = 1 then
        if enemy22hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 350, enemyymov - 50, 0)
        elsif enemy22hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 350, enemyymov - 50, 0)
        elsif enemy22hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 350, enemyymov - 50, 0)
        end if
    end if


    if enemy23 = 1 then
        if enemy23hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 400, enemyymov - 50, 0)
        elsif enemy23hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 400, enemyymov - 50, 0)
        elsif enemy23hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 400, enemyymov - 50, 0)
        end if
    end if


    if enemy24 = 1 then
        if enemy24hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 450, enemyymov - 50, 0)
        elsif enemy24hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 450, enemyymov - 50, 0)
        elsif enemy24hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 450, enemyymov - 50, 0)
        end if
    end if

    if enemy25 = 1 then
        if enemy25hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 500, enemyymov - 50, 0)
        elsif enemy25hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 500, enemyymov - 50, 0)
        elsif enemy25hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 500, enemyymov - 50, 0)
        end if
    end if



    if enemy26 = 1 then
        if enemy26hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 550, enemyymov - 50, 0)
        elsif enemy26hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 550, enemyymov - 50, 0)
        elsif enemy26hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 550, enemyymov - 50, 0)
        end if
    end if

   
    if enemy27 = 1 then
        if enemy27hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 600, enemyymov - 50, 0)
        elsif enemy27hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 600, enemyymov - 50, 0)
        elsif enemy27hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 600, enemyymov - 50, 0)
        end if
    end if
   
    if enemy28 = 1 then
        if enemy28hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 650, enemyymov - 50, 0)
        elsif enemy28hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 650, enemyymov - 50, 0)
        elsif enemy28hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 650, enemyymov - 50, 0)
        end if
    end if

    if enemy29 = 1 then
        if enemy29hp = 3 then
            Pic.Draw (mypic2, enemyxmov, enemyymov - 100, 0)
        elsif enemy29hp = 2 then
            Pic.Draw (mypic3, enemyxmov, enemyymov - 100, 0)
        elsif enemy29hp = 1 then
            Pic.Draw (mypic4, enemyxmov, enemyymov - 100, 0)
        end if
    end if



    if enemy30 = 1 then



        if enemy30hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 50, enemyymov - 100, 0)
        elsif enemy30hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 50, enemyymov - 100, 0)
        elsif enemy30hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 50, enemyymov - 100, 0)
        end if
    end if



    if enemy31 = 1 then
        if enemy31hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 100, enemyymov - 100, 0)
        elsif enemy31hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 100, enemyymov - 100, 0)
        elsif enemy31hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 100, enemyymov - 100, 0)
        end if
    end if


    if enemy32 = 1 then
        if enemy32hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 150, enemyymov - 100, 0)
        elsif enemy32hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 150, enemyymov - 100, 0)
        elsif enemy32hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 150, enemyymov - 100, 0)
        end if
    end if



    if enemy33 = 1 then
        if enemy33hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 200, enemyymov - 100, 0)
        elsif enemy33hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 200, enemyymov - 100, 0)
        elsif enemy33hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 200, enemyymov - 100, 0)
        end if
    end if



    if enemy34 = 1 then
        if enemy34hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 250, enemyymov - 100, 0)
        elsif enemy34hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 250, enemyymov - 100, 0)
        elsif enemy34hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 250, enemyymov - 100, 0)
        end if
    end if

    if enemy35 = 1 then
        if enemy35hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 300, enemyymov - 100, 0)
        elsif enemy35hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 300, enemyymov - 100, 0)
        elsif enemy35hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 300, enemyymov - 100, 0)
        end if
    end if


    if enemy36 = 1 then
        if enemy36hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 350, enemyymov - 100, 0)
        elsif enemy36hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 350, enemyymov - 100, 0)
        elsif enemy36hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 350, enemyymov - 100, 0)
        end if
    end if


    if enemy37 = 1 then
        if enemy37hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 400, enemyymov - 100, 0)
        elsif enemy37hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 400, enemyymov - 100, 0)
        elsif enemy37hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 400, enemyymov - 100, 0)
        end if
    end if


    if enemy38 = 1 then
        if enemy38hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 450, enemyymov - 100, 0)
        elsif enemy38hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 450, enemyymov - 100, 0)
        elsif enemy38hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 450, enemyymov - 100, 0)
        end if
    end if

    if enemy39 = 1 then
        if enemy39hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 500, enemyymov - 100, 0)
        elsif enemy39hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 500, enemyymov - 100, 0)
        elsif enemy39hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 500, enemyymov - 100, 0)
        end if
    end if



    if enemy40 = 1 then
        if enemy40hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 550, enemyymov - 100, 0)
        elsif enemy40hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 550, enemyymov - 100, 0)
        elsif enemy40hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 550, enemyymov - 100, 0)
        end if
    end if

   
    if enemy41 = 1 then
        if enemy41hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 600, enemyymov - 100, 0)
        elsif enemy41hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 600, enemyymov - 100, 0)
        elsif enemy41hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 600, enemyymov - 100, 0)
        end if
    end if
   
    if enemy42 = 1 then
        if enemy42hp = 3 then
            Pic.Draw (mypic2, enemyxmov + 650, enemyymov - 100, 0)
        elsif enemy42hp = 2 then
            Pic.Draw (mypic3, enemyxmov + 650, enemyymov - 100, 0)
        elsif enemy42hp = 1 then
            Pic.Draw (mypic4, enemyxmov + 650, enemyymov - 100, 0)
        end if
    end if


    if enemy1 = 0 and enemy2 = 0 and enemy3 = 0 and enemy4 = 0 and enemy5 = 0 and enemy6 = 0 and enemy7 = 0 and enemy8 = 0 and enemy9 = 0 and enemy10 = 0 and enemy11 = 0 and enemy12 = 0 and enemy13 = 0 and enemy14 = 0 then
        font := Font.New ("serif:40")
        for h : 1..100
        Draw.Text ("Congrats!", maxx div 2 - 100, 450, font, red)
        Draw.Text ("You Won!", maxx div 2 - 110, 350, font, red)
    end for
    loop
 
    get choice2
    if choice2 = "n" then
    score := 0
    exit
    elsif choice2 = "y" then
    exit
    end if
    end loop
   
enemy1 := 1
enemy2 := 1
enemy3 := 1
enemy4 := 1
enemy5 := 1
enemy6 := 1
enemy7 := 1
enemy8 := 1
enemy9 := 1
enemy10 := 1
enemy11 := 1
enemy12 := 1
enemy13 := 1
enemy14 := 1
enemy15 := 1
enemy16 := 1
enemy17 := 1
enemy18 := 1
enemy19 := 1
enemy20 := 1
enemy21 := 1
enemy22 := 1
enemy23 := 1
enemy24 := 1
enemy25 := 1
enemy26 := 1
enemy27 := 1
enemy28 := 1
enemy29 := 1
enemy30 := 1
enemy31 := 1
enemy32 := 1
enemy33 := 1
enemy34 := 1
enemy35 := 1
enemy36 := 1
enemy37 := 1
enemy38 := 1
enemy39 := 1
enemy40 := 1
enemy41 := 1
enemy42 := 1

enemy1hp := 3
enemy2hp := 3
enemy3hp := 3
enemy4hp := 3
enemy5hp := 3
enemy6hp := 3
enemy7hp := 3
enemy8hp := 3
enemy9hp := 3
enemy10hp := 3
enemy11hp := 3
enemy12hp := 3
enemy13hp := 3
enemy14hp := 3
enemy15hp := 3
enemy16hp := 3
enemy17hp := 3
enemy18hp := 3
enemy19hp := 3
enemy20hp := 3
enemy21hp := 3
enemy22hp := 3
enemy23hp := 3
enemy24hp := 3
enemy25hp := 3
enemy26hp := 3
enemy27hp := 3
enemy28hp := 3
enemy29hp := 3
enemy30hp := 3
enemy31hp := 3
enemy32hp := 3
enemy33hp := 3
enemy34hp := 3
enemy35hp := 3
enemy36hp := 3
enemy37hp := 3
enemy38hp := 3
enemy39hp := 3
enemy40hp := 3
enemy41hp := 3
enemy42hp := 3
        end if
end enemyproc


%instructions

loop
Pic.Draw (mypic7, 0, 0, 0)
    get continue
    exit when continue = "y"
end loop


forward proc movement



proc shoot
    loop
        shot := 1
        bullety := bullety + 2
        exit when bullety + 20 > 450
        movement
    end loop
    shot := 0
end shoot

proc enemyshoot
 loop
 

 
 
 
enemyshot := 1
        enemyby -= 1
        if enemyby - 20 = 0 then
        enemyby := 250
         randint (z, 1, 14)
if z = 1 then
enemybxz := 100
elsif z = 2 then
enemybxz := 150
elsif z = 3 then
enemybxz := 200
elsif z = 4 then
enemybxz := 250
elsif z = 5 then
enemybxz := 300
elsif z = 6 then
enemybxz := 350
elsif z = 7 then
enemybxz := 400
elsif z = 8 then
enemybxz := 450
elsif z = 9 then
enemybxz := 500
elsif z = 10 then
enemybxz := 550
elsif z = 11 then
enemybxz := 600
elsif z = 12 then
enemybxz := 650
elsif z = 13 then
enemybxz := 700
elsif z = 14 then
enemybxz := 750
end if
        end if
        movement
    end loop
    enemyshot := 0
end enemyshoot
  enemyshoot
body proc movement

    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) and shot = 0 then
        bullety := y
        bulletx := x
        shoot
     
    elsif chars (KEY_DOWN_ARROW) then
    if bombs > 0 then
    Pic.Draw (mypic5, 200, 0, 0)
   bomb
end if

    elsif chars (KEY_LEFT_ARROW) and x > 0 then
        x := x - 1
    elsif chars (KEY_RIGHT_ARROW) and x + 64 < maxx then
        x := x + 1
    end if


   
    cls
   
    Pic.Draw (mypic8, 0, 0, 0)
   
    enemyproc

    shootlazer

    if shot = 1 then

        drawfillbox (bulletx + 24, bullety, bulletx + 26, bullety + 20, white)
end if

if enemyshot = 1 then
     

  drawfilloval (enemybxz, enemyby, 2, 2,   white)

  end if
 
 
   

 if score > highscore then
highscore := score
end if
     put "SCORE: ", score..
     put "     Highscore: ", highscore..
     put "     Lives: ", shiphp..
     put "     continue? y. new game? n."





    Pic.Draw (mypic, x, 30, 0)
    View.Update

end movement

loop
randint (z, 1, 14)
if z = 1 then
enemybxz := 100
elsif z = 2 then
enemybxz := 150
elsif z = 3 then
enemybxz := 200
elsif z = 4 then
enemybxz := 250
elsif z = 5 then
enemybxz := 300
elsif z = 6 then
enemybxz := 350
elsif z = 7 then
enemybxz := 400
elsif z = 8 then
enemybxz := 450
elsif z = 9 then
enemybxz := 500
elsif z = 10 then
enemybxz := 550
elsif z = 11 then
enemybxz := 600
elsif z = 12 then
enemybxz := 650
elsif z = 13 then
enemybxz := 700
elsif z = 14 then
enemybxz := 750
end if

if shiphp > 0 then


    movement
if choice2 = "e" then
exit
end if
end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
gitoxa




PostPosted: Mon May 19, 2008 2:15 pm   Post subject: RE:SPACE INVADERS help

HOLY CRAP ARRAYS

It needed to be said.

code:
var enemy : array 1 .. 42 of int
for i : 1 .. 42
    enemy(i) := 1
end for
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: