Computer Science Canada

Space Invaders help

Author:  andyman [ Thu Jun 12, 2003 6:18 pm ]
Post subject:  Space Invaders help

Confused I've been designing a space invaders game on Turing 3. something and I can't figure out how to make the laser (the red thing that comes out of triangle) shoot and destroy oncoming enemies from the right. Unfortunately the extent of my teachers turing knowledge is a put statement and I'm the smartest guy in my class *laugh*. He doesn't even know how to update turing on our school's server!

Anywho, here's the program so far
code:

var w : int := Window.Open ("fullscreen")
Window.Set (w, "nocursor")
setscreen ("graphics")

% Background
drawbox ( - 1, - 1, 800, 601, 54)
drawfill (1, 1, 16, 54)

% Basic
drawline (100, 5, 150, 26, 55)
drawline (100, 55, 150, 26, 55)
drawline (100, 55, 100, 5, 55)
drawfill (105, 16, 55, 55)

%Controls
var x, e : int
var c : string (1)
x := 0
loop
    getch (c)
    if c = chr (200) and x < 540 then

        drawline (100, x, 150, 21 + x, 55)
        drawline (100, 50 + x, 150, 21 + x, 55)
        drawline (100, 50 + x, 100, x, 55)
        drawfill (1, 1, 16, 54)
        x := x + 5
        e := 26 + x
    elsif c = chr (208) and x > 0 then
        drawline (100, 10 + x, 150, 31 + x, 55)
        drawline (100, 60 + x, 150, 31 + x, 55)
        drawline (100, 60 + x, 100, 10 + x, 55)
        drawfill (1, 1, 16, 54)
        x := x - 5
        e := 26 + x
    elsif c = chr (205) then
        for t : 1 .. 700 by 10
            drawline (150 + t, e, 180 + t, e, red)
            delay (10)
            drawline (150 + t, e, 180 + t, e, 16)
        end for
    end if

    drawline (100, 5 + x, 150, e, 55)
    drawline (100, 55 + x, 150, e, 55)
    drawline (100, 55 + x, 100, 5 + x, 55)
    drawfill (105, 15 + x, 55, 55)



end loop


If you could help me or just give me tips ASAP, I'd really appreciate it

Author:  Mazer [ Thu Jun 12, 2003 6:26 pm ]
Post subject: 

before you go any further i'm gonna have to ask you to switch to turing v4.04 if you have it. games that use the keyboard are just awful without Input.KeyDown.

and if you don't have turing 4, i suggest using the mouse for flying the ship. ie, if the mouse y coord is greater than the ship's y coord, increase y, if it is lower, decrease y. in case you don't know how to use the mouse there are some good tutorials somewhere around here:
http://www.compsci.ca/bbs/viewtopic.php?t=6

Author:  born130 [ Thu Jun 12, 2003 7:16 pm ]
Post subject: 

are u andy sun?

Author:  andyman [ Thu Jun 12, 2003 7:25 pm ]
Post subject: 

No I'm Andy Johnson

Author:  Homer_simpson [ Thu Jun 12, 2003 8:16 pm ]
Post subject: 

try reading the collision detection tutorials on this website first... theil help u with detecting when the laser hits your enemies...

Author:  Asok [ Thu Jun 12, 2003 8:47 pm ]
Post subject: 

I've made Space Invaders 2.

I'll post it in July.

Author:  Andy [ Fri Jun 13, 2003 10:39 am ]
Post subject: 

hmm isn't it called glaxian

Author:  Asok [ Fri Jun 13, 2003 1:26 pm ]
Post subject: 

MINE is called space invaders 2 Razz

Author:  naoki [ Fri Jun 13, 2003 9:54 pm ]
Post subject: 

use like a process to control a shooting animation so it'll shoot while u move

everything else is just collision detection and seeing when you hit the upper bound, when the max number of bullets is achieved, and so on. i won't tell u everything, experiment 1st and then i'll help u some more

Author:  Andy [ Sat Jun 14, 2003 4:03 pm ]
Post subject: 

born 130, shut up, stop saying my full name u fag and no its not me, u'd know i'm better than that and i dun use turing 3

Author:  hello [ Sun Jun 15, 2003 1:18 pm ]
Post subject: 

offscreenonly
View.Update
wait does turing 3.0 have View.Update?

Author:  born130 [ Sun Jun 15, 2003 1:51 pm ]
Post subject: 

no

Author:  Andy [ Sun Jun 15, 2003 3:09 pm ]
Post subject: 

and once again, born130 gets 2 bits for 2 lettersr

Author:  PaddyLong [ Sun Jun 15, 2003 3:10 pm ]
Post subject: 

he was answering a question that was asked...

Author:  85882 [ Mon Jun 16, 2003 3:53 pm ]
Post subject: 

Your program is good so far. Wink

Author:  Andy [ Mon Jun 16, 2003 4:40 pm ]
Post subject: 

and hello, only turing 4.01p and up has View.Update

Author:  Andy [ Mon Jun 16, 2003 4:42 pm ]
Post subject: 

hey the next version of turing 4.04d has View.UpdateArea and Window.UpdateArea which allows the user to only View.Update a small area, very useful

Author:  naoki [ Mon Jun 16, 2003 4:54 pm ]
Post subject: 

would've prolly helped my game. i could make the bullets nicer w/out making the whole damn screen flicker.

for those who don't know, it was a Raiden-esque shooter

Author:  Andy [ Mon Jun 16, 2003 4:57 pm ]
Post subject: 

read my post naoki, its out NEXT version, not this version

Author:  BlAcK TuRtLe [ Wed Jun 18, 2003 3:37 pm ]
Post subject: 

when does the next version come out?

Author:  JayLo [ Wed Jun 18, 2003 3:46 pm ]
Post subject: 

well... according to Tom West: June 2003. according to reality: next year? who cares?


: