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

Username:   Password: 
 RegisterRegister   
 Space Invaders
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Azzy




PostPosted: Sat May 21, 2005 12:09 pm   Post subject: Space Invaders

I'm trying to make a Space Invaders game but I got a problem. If I use a procedure for the gun, everytime you shoot your ship thing disappears and then reapears after the shot is gone. If I use a process, the ball goes flying up extremely fast and then begins to slow down. Can someone please help me solve this problem so I can continue on?

code:
var x := 320
var gunx : int
var guny := 30
var chars : array char of boolean

process gun
    loop
        Draw.FillOval (gunx, guny, 5, 5, black)
        delay (10)
        Draw.FillOval (gunx, guny, 5, 5, white)
        guny := guny + 1
        exit when guny = 480
    end loop
    guny := 30
end gun

loop
    Input.KeyDown (chars)
    Draw.FillOval (x, 30, 10, 10, red)
    delay (5)
    Draw.FillOval (x, 30, 10, 10, white)
    if chars (KEY_LEFT_ARROW) then
        x := x - 1
        if x <= 10 then
            x := x + 1
        end if
    elsif chars (KEY_RIGHT_ARROW) then
        x := x + 1
        if x >= 625 then
            x := x - 1
        end if
    elsif chars (KEY_CTRL) then
        gunx := x
        fork gun
    end if
end loop
Sponsor
Sponsor
Sponsor
sponsor
MysticVegeta




PostPosted: Sat May 21, 2005 12:21 pm   Post subject: (No subject)

There are around 50 topics regarding shooting. Also, use View.Update and dont use the processes, they screw your CPU up and have bugs.[/code]
Neo




PostPosted: Sat May 21, 2005 1:43 pm   Post subject: (No subject)

Dont use processes. Make ur shoot procedure use the main loop and keep track of it with a counter.
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  [ 3 Posts ]
Jump to:   


Style:  
Search: