Reading a variable and setting it permanently (dont want projectile to follow ships x co-ordinates)
Author |
Message |
alex8642
|
Posted: Mon May 25, 2009 9:42 am Post subject: Reading a variable and setting it permanently (dont want projectile to follow ships x co-ordinates) |
|
|
My problem is that I need my laser to fire and then continue regardless of ship position... This means I need to use the x and y value of the ship but after I need it to not use those values... use new values to move forward but I do not know how
Turing: |
View.Set ("title:Turecraft: A game of epic proportions")
% Program: Turcraft
% version: 1.1 Alpha
% Alexander Feht, Alex Bigalow
% Mr. Rancourt
var a, b, c, s, x, y, r1, r2, x1, x2, y1, y2, picID, picID2, picID3, picID4, picID5, picID6, picID7, picID8, picID9, picID10, picIDshot, picenemyG1, picenemyG2, picenemyG3, picenemyG4, picenemyG5, picenemyG6, picenemyG7,picenemyM1, picenemyM2, picenemyM3, picenemyM4, picenemyM5, picIDboom1, picIDboom3, picIDboom2, picIDboomgif : int %declaring variables
var numFrames := Pic.Frames ("h:\\ICE-4M1\\scoutboomgif.gif")
var pics : array 1 .. numFrames of int
var delayTime : int
% loading pictures into memory
picID := Pic.FileNew ("h:\\ICE-4M1\\back2.bmp")
picID2 := Pic.FileNew ("h:\\ICE-4M1\\scoutS.bmp")
picID3 := Pic.FileNew ("h:\\ICE-4M1\\scoutS1.bmp")
picID4 := Pic.FileNew ("h:\\ICE-4M1\\scoutS3.bmp")
picID5 := Pic.FileNew ("h:\\ICE-4M1\\scoutS4.bmp")
picID6 := Pic.FileNew ("h:\\ICE-4M1\\scoutS5.bmp")
picID7 := Pic.FileNew ("h:\\ICE-4M1\\scoutS7.bmp")
picID8 := Pic.FileNew ("h:\\ICE-4M1\\scoutS8.bmp")
picID9 := Pic.FileNew ("h:\\ICE-4M1\\scoutS9.bmp")
picID10 := Pic.FileNew ("h:\\ICE-4M1\\scoutS10.bmp")
picIDboom1 := Pic.FileNew ("h:\\ICE-4M1\\scoutboom1.bmp")
picIDboom3 := Pic.FileNew ("h:\\ICE-4M1\\scoutboom3.bmp")
picIDboom2 := Pic.FileNew ("h:\\ICE-4M1\\scoutboom2.bmp")
picIDboomgif := Pic.FileNew ("h:\\ICE-4M1\\scoutboomgif.gif")
picenemyG1 := Pic.FileNew ("h:\\ICE-4M1\\Guardian1.bmp")
picenemyG2 := Pic.FileNew ("h:\\ICE-4M1\\Guardian2.bmp")
picenemyG3 := Pic.FileNew ("h:\\ICE-4M1\\Guardian3.bmp")
picenemyG4 := Pic.FileNew ("h:\\ICE-4M1\\Guardian4.bmp")
picenemyG5 := Pic.FileNew ("h:\\ICE-4M1\\Guardian5.bmp")
picenemyG6 := Pic.FileNew ("h:\\ICE-4M1\\Guardian6.bmp")
picenemyG7 := Pic.FileNew ("h:\\ICE-4M1\\Guardian7.bmp")
picenemyM1 := Pic.FileNew ("h:\\ICE-4M1\\Mutalisk1.bmp")
picenemyM2 := Pic.FileNew ("h:\\ICE-4M1\\Mutalisk2.bmp")
picenemyM3 := Pic.FileNew ("h:\\ICE-4M1\\Mutalisk3.bmp")
picenemyM4 := Pic.FileNew ("h:\\ICE-4M1\\Mutalisk4.bmp")
picenemyM5 := Pic.FileNew ("h:\\ICE-4M1\\Mutalisk5.bmp")
picIDshot := Pic.FileNew ("h:\\ICE-4M1\\shot.bmp")
Pic.FileNewFrames ("h:\\ICE-4M1\\scoutboomgif.gif", pics, delayTime )
% sets the screen for the games configuration such as off screen rendering
setscreen ("graphics:640;480,nobuttonbar")
View.Set ("offscreenonly")
x := 300 % x axis of location of ship at beginning of play
y := 25 % sets location of ship at beginning of play
a := Rand.Int (100, 400)
c := 75
b := 0
s := x + c
loop % the game begins
Pic.Draw (picID, 0, 0, picCopy) % draws background
Pic.Draw (picID2, x, y, picMerge) % the ship
b := b + 1
Pic.Draw (picenemyG1, a, maxy - 100 - b, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
% moving the ship
if parallelget = 88 % right
then
Pic.Draw (picID4, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
x := x + 5
end if
if parallelget = 112 % up
then
Pic.Draw (picID3, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y + 5
end if
if parallelget = 104 % left
then
Pic.Draw (picID5, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
x := x - 5
end if
if parallelget = 56 % down
then
Pic.Draw (picID6, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y - 5
end if
if parallelget = 24 % down right
then
Pic.Draw (picID9, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y - 5
x := x + 5
end if
if parallelget = 40 % down left
then
Pic.Draw (picID10, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y - 5
x := x - 5
end if
if parallelget = 80 % up right
then
Pic.Draw (picID7, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y + 5
x := x + 5
end if
if parallelget = 96 % up left
then
Pic.Draw (picID8, x, y, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
y := y + 5
x := x - 5
end if
% programming for firing the laser
if parallelget = 240 % up
then
x := x
y := y + 5
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 216 % right
then
x := x
y := y
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 184 % down
then
x := x
y := y - 5
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 232 % left
then
x := x
y := y
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 208 % up right
then
x := x + 5
y := y + 5
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 152 % down right
then
x := x + 5
y := y - 5
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 168 % down left
then
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
View.UpdateArea (0, 0, maxx, maxy)
if parallelget = 224 % up left
then
x := x - 5
y := y + 5
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
if parallelget = 248 % btn
then
Pic.Draw (picIDshot, x + 30, y + 75, picMerge)
View.UpdateArea (0, 0, maxx, maxy)
end if
%where I am trying to get picIDshot to detect monster
if picIDshot < b and picIDshot > b then
cls
exit
end if
% this detects and stops the ship from moving off the screen
if x < 0 then
x := x + 5
elsif y < 0 then
y := y + 5
elsif x > maxx - 65 then
x := x - 5
elsif y > maxy - 75 then
y := y - 5
end if
% end of border detection
% Ship explodes if it touches any enemies (incomplete)
if x = picenemyG1 and y = picenemyG1 then
View.Set ("nooffscreenonly")
for i : 1 .. 12
delay (10)
Pic.DrawFrames (pics, x, y - 10, picMerge, numFrames, 10, false)
end for
exit
end if
end loop
put "GAME OVER BITCH"
|
Turing v4.1.1a |
|
|
|
|
|
Sponsor Sponsor
|
|
|
|
|