Posted: Mon Apr 04, 2011 11:07 am Post subject: shooting help
What is it you are trying to achieve?
Im trying to copy a game called Galaga for a school project
What is the problem you are having?
Im having problems with shooting and killing enemies, so any help you guys can provide will be greatly appreacited
Describe what you have tried to solve this problem
<Answer Here>
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>
Turing:
<Add your code here>
Please specify what version of Turing you are using
<Answer Here>
Sponsor Sponsor
apython1992
Posted: Mon Apr 04, 2011 11:54 am Post subject: RE:shooting help
How about "Describe what you have tried to solve this problem" and "Post any relevant code"?
Raknarg
Posted: Mon Apr 04, 2011 3:02 pm Post subject: RE:shooting help
Well, I doubt you'd get it, but you could attempt at taking a look at my program in submissions...
Raknarg
Posted: Mon Apr 04, 2011 3:02 pm Post subject: RE:shooting help
Have you learned arrays yet?
mnorman
Posted: Tue Apr 12, 2011 11:24 am Post subject: Re: shooting help
yes i have
apython1992
Posted: Tue Apr 12, 2011 11:37 am Post subject: RE:shooting help
You won't get much help until you show that you're trying to solve the problem and tell us everything you've tried, and exactly what you aren't sure how to do. You have to be specific.
Raknarg
Posted: Tue Apr 12, 2011 3:19 pm Post subject: RE:shooting help
You should post at least any code you have. If you don't know what to do at all, you should probs pick something easier.
apython1992
Posted: Tue Apr 12, 2011 3:41 pm Post subject: Re: RE:shooting help
Raknarg @ Tue Apr 12, 2011 3:19 pm wrote:
You should post at least any code you have. If you don't know what to do at all, you should probs pick something easier.
Well, one shouldn't resort to giving up and picking something easier just because he/she doesn't know how to do it. Learning is wonderful.
Sponsor Sponsor
Raknarg
Posted: Tue Apr 12, 2011 3:44 pm Post subject: RE:shooting help
I know, but I'm just saying, for something as big as this, you should start with something easier if you don't know what to do, or at least in my opinion.
Scratch my last post then. Give us any code if you have any.
mnorman
Posted: Wed Apr 13, 2011 10:22 am Post subject: RE:shooting help
heres what i have come up wiith so far and now i would appreicate help with adding enemies. Sorry for being such a nood but this is my first attempt at programming a game. Also how do i get to submissions?
setscreen ("graphics:790;1050,nobuttonbar,position:center;center,offscreenonly")
var bulletsX, bulletsY : flexible array 1 .. 0 of int
var deadbullet : flexible array 1 .. 0 of boolean
var chars : array char of boolean
var counter : int := 50
var x : int := 450
var ship : int := Pic.FileNew ("small ship.bmp")
var bullet : int := Pic.FileNew ("bullet.bmp")
loop
Input.KeyDown (chars)
if chars (' ') and counter >= 50 then
new bulletsX, upper (bulletsX) + 1
new bulletsY, upper (bulletsY) + 1
new deadbullet, upper (deadbullet) + 1
bulletsX (upper (bulletsX)) := 0
bulletsY (upper (bulletsX)) := x
counter := 0
end if
if chars (KEY_RIGHT_ARROW) and x - 10 >= 0 and x + 50 <= 790 then
x := x + 2
elsif chars (KEY_LEFT_ARROW) and x - 10 >= 0 and x + 50 <= 790 then
x := x - 2
elsif x - 10 <= 0 then
x := x + 1
elsif x + 50 >= 790 then
x := x - 1
end if
colorback (7)
Pic.Draw (ship, x, 70, picMerge)
for i : lower (bulletsX) .. upper (bulletsX)
if bulletsX (i) > maxx then
deadbullet (i) := true
bulletsX (i) := 10000
else
deadbullet (i) := false
end if
if deadbullet (i) = false then
bulletsX (i) := bulletsX (i) + 3
Pic.Draw (bullet, bulletsY (i) + 20, bulletsX (i) + 105, picMerge)
end if
end for
View.Update
counter := counter + 1
delay (5)
cls
end loop
Raknarg
Posted: Wed Apr 13, 2011 2:39 pm Post subject: RE:shooting help
On the home screen, go to turing then submissions.
Raknarg
Posted: Wed Apr 13, 2011 2:40 pm Post subject: RE:shooting help
could you link pictures too? just add an attachment
apython1992
Posted: Wed Apr 13, 2011 2:51 pm Post subject: RE:shooting help
Just a side note, you're likely to get more help by posting properly formatted code using code/syntax tags. For example:
Posted: Thu Apr 14, 2011 10:16 am Post subject: RE:shooting help
do i have to do that for every line or just the first?
mnorman
Posted: Thu Apr 14, 2011 10:24 am Post subject: Re: shooting help
Turing:
setscreen("graphics:790;1050,nobuttonbar,position:center;center,offscreenonly") var bulletsX, bulletsY :flexiblearray1.. 0ofint var deadbullet :flexiblearray1.. 0ofboolean var chars :arraycharofboolean var counter :int:=50 var x :int:=450 var ship :int:=Pic.FileNew("small ship.bmp") var bullet :int:=Pic.FileNew("bullet.bmp")
if chars (' ')and counter >= 50then new bulletsX, upper(bulletsX) + 1 new bulletsY, upper(bulletsY) + 1 new deadbullet, upper(deadbullet) + 1
bulletsX (upper(bulletsX)):=0
bulletsY (upper(bulletsX)):= x
counter :=0 endif
if chars (KEY_RIGHT_ARROW)and x - 10 >= 0and x + 50 <= 790then
x := x + 2 elsif chars (KEY_LEFT_ARROW)and x - 10 >= 0and x + 50 <= 790then
x := x - 2 elsif x - 10 <= 0then
x := x + 1 elsif x + 50 >= 790then
x := x - 1 endif