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

Username:   Password: 
 RegisterRegister   
 Im making a game, but am just plain stuck
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
HKYPLAYA4LIFE




PostPosted: Sat May 22, 2004 10:23 am   Post subject: Im making a game, but am just plain stuck

Ok, I am making a game similar to counter strike where you have a cursor on the mouse and you shoot at terrorists. I have the basics set up but I cant figure out how to make the terrorists appear then you have a certain amount of time to shoot them then it disappears and you have to shoot at the new target. Any help would be a appreciated thanks. I was going to use an array and a for statment to make the terrorists appear but I couldnt figure out how to do it.

code:
    procedure crosshair (x, y : int)
        drawline (x - 3, y - 3, x - 8, y - 8, brightgreen)
        drawline (x + 3, y + 3, x + 8, y + 8, brightgreen)
        drawline (x - 3, y + 3, x - 8, y + 8, brightgreen)
        drawline (x + 3, y - 3, x + 8, y - 8, brightgreen)
    end crosshair
   
    procedure terrorists (ter,ter1: string)
    Pic.ScreenLoad (ter, 100, 200, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter, 500, 200, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter, 200, 300, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter,100, 0, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter, 300, 300, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter1, 100, 100, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter, 600, 200, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter, 200, 100, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter1, 800, 500, 0)
    View.Update
    delay(200)
    cls
    Pic.ScreenLoad (ter1, 400, 400, 0)
View.Update
    delay(200)
    cls
    end terrorists
   
   
    View.Set ("graphics:max;max")
setscreen ("graphics")
setscreen ("nocursor")
var winID : int
winID := Window.Open ("position:middle;middle,graphics:1012;700")
Mouse.Hide
var x, y, button : int
var gun, menu, key : string (1)
loop
    cls
    var usp : string := ("usp.bmp")
    var usp1 : string := ("usp1.bmp")
    var usp2 : string := ("usp2.bmp")
    var usp3 : string := ("usp3.bmp")
    var deagle : string := ("deagle.bmp")
    var deagle1 : string := ("deagle1.bmp")
    var deagle2 : string := ("deagle2.bmp")
    var ak47 : string := ("ak47.bmp")
    var ak471 : string := ("ak471.bmp")
    var ter : string := ("ter.bmp")
    var ter1 : string := ("ter1.bmp")
    colourback (black)
    cls
    locate (5, 40)
    color (brightred)
    put "Welcome to Counter-Strike aim practise!"
    color (white)
    locate (6, 53)
    put "by Neil Martin"
    delay (1300)
    colour (brightgreen)
    locate (20, 40)
    put "Please make a selection"
    put "(1) Instructions"
    put "(2) Weapon Selection"
    put "(3) Exit Game"
    loop
        color (blue)
        getch (menu)
        if menu = "1" then
            cls
            color (white)
            put "You are on a Counter-Terrorist force!"
            put "Shoot all the terrorists you see."
            put "You only have a short time, so be quick!"
            put "A hit is worth 50 points and a headshot is worth 100 points!"
            put "A miss is -100 points, so make sure you shoot accurately."
            put "After you use all of your ammo in your clip press 'space' to reload"
            put "Good luck and have fun!"
            getch (key)
            menu := "2"
            cls
        elsif menu = "3" then
            Window.Close (winID)
        end if
        exit when menu = "2"
    end loop
    cls
    put "Please select your weapon!"
    put ""
    put ""
    put "(1) USP"
    put "(2) Deagle"
    put "(3) AK47"
    put "(4) To return to main menu"
    getch (gun)
    colorback (white)
    View.Set ("offscreenonly")

    if gun = "1" then
        loop
            cls
            Pic.ScreenLoad (usp, 830, -30, 0)
            mousewhere (x, y, button)
            crosshair (x, y)
            if button = 1 then
                cls
                Pic.ScreenLoad (usp, 830, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (usp1, 830, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (usp2, 830, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (usp3, 830, -30, 0)
                delay (50)
                View.Update
                delay (50)
                cls
            end if
            View.Update
terrorists (ter,ter1)
            end loop
    elsif gun = "2" then
        loop
            cls
            Pic.ScreenLoad (deagle, 752, -30, 0)
            mousewhere (x, y, button)
            crosshair (x, y)
            View.Update
            if button = 1 then
                cls
                Pic.ScreenLoad (deagle, 830, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (deagle1, 580, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (deagle2, 690, -30, 0)
                delay (50)
                View.Update
                delay (50)
                cls
            end if
            View.Update
        terrorists(ter,ter1)
            end loop
    elsif gun = "3" then
        loop
            cls
            Pic.ScreenLoad (ak47, 500, -90, 0)
            mousewhere (x, y, button)
            if button = 1 then
                cls
                Pic.ScreenLoad (ak471, 500, -90, 0)
                View.Update
                delay (80)
                cls
            end if
            crosshair (x, y)
            View.Update
        terrorists (ter,ter1)
            end loop
        exit when gun = "4"
    end if
end loop


EDIT- P.S. this is my final project for my comp sci class.
Sponsor
Sponsor
Sponsor
sponsor
Delta




PostPosted: Sat May 22, 2004 11:19 am   Post subject: (No subject)

Well you could always try something like this.

%Draw terrorist
delay (1000) % one second
% Hide terrorist

very simple....

P.S. - It may help to add pictures Wink
HKYPLAYA4LIFE




PostPosted: Sat May 22, 2004 11:27 am   Post subject: (No subject)

I wasnt sure how to add pictures on here Confused
HKYPLAYA4LIFE




PostPosted: Sat May 22, 2004 11:21 pm   Post subject: (No subject)

Can anyone help me out a bit here?
Dan




PostPosted: Sun May 23, 2004 12:30 am   Post subject: (No subject)

How to uses pics in turing:
http://www.compsci.ca/v2/viewtopic.php?t=191
Computer Science Canada Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more!
HKYPLAYA4LIFE




PostPosted: Sun May 23, 2004 11:03 am   Post subject: (No subject)

Hacker Dan wrote:
Thanks. Is it better for me to use the form you are showing there or the Pic.ScreenLoad because it worked well for the guns. I was just confused about the targets.
Paul




PostPosted: Sun May 23, 2004 11:22 am   Post subject: (No subject)

I'd say its better to use what Dan gave u, and get rid of that avatar, it might offend someone, or get this site banned from some schools.
HKYPLAYA4LIFE




PostPosted: Sun May 23, 2004 11:48 am   Post subject: (No subject)

Avatar is gone, sorry. Crying or Very sad
HKYPLAYA4LIFE




PostPosted: Sun May 23, 2004 4:31 pm   Post subject: (No subject)

Hacker Dan, could ou help me out here, It just wont work using your method. It creates a major lag in the program and doesnt work as smooth as the way I had it. I have changed my coding quite a bit but I still cannot get it to work the way I want. How can I upload my pics so you can see whats going wrong in my program? Thanks. This is my furthest progressed program.

code:
procedure crosshair (x, y : int)
        drawline (x - 3, y - 3, x - 8, y - 8, brightgreen)
        drawline (x + 3, y + 3, x + 8, y + 8, brightgreen)
        drawline (x - 3, y + 3, x - 8, y + 8, brightgreen)
        drawline (x + 3, y - 3, x + 8, y - 8, brightgreen)
    end crosshair
    View.Set ("graphics:max;max")
setscreen ("graphics")
setscreen ("nocursor")
var winID : int
winID := Window.Open ("position:middle;middle,graphics:1012;700")
Mouse.Hide
var x, y, button : int
var gun, menu, key : string (1)
loop
    cls
    var usp : string := ("usp.bmp")
    var usp1 : string := ("usp1.bmp")
    var usp2 : string := ("usp2.bmp")
    var usp3 : string := ("usp3.bmp")
    var deagle : string := ("deagle.bmp")
    var deagle1 : string := ("deagle1.bmp")
    var deagle2 : string := ("deagle2.bmp")
    var ak47 : string := ("ak47.bmp")
    var ak471 : string := ("ak471.bmp")
    var ter : string := ("ter.bmp")
    var ter1 : string := ("ter1.bmp")
    var over: array 1..15 of int
    var up: array 1..15 of int
    over(1):= 0
    over(2):= 600
    over(3):= 500
    over(4):= 100
    over(5):= 300
    over(6):= 50
    over(7):= 400
    over(8):= 600
    over(9):= 0
    over(10):= 50
    over(11):= 300
    over(12):= 0
    over(13):= 600
    over(14):= 500
    over(15):= 400
    up(1):=0
    up(2):=300
    up(3):=50
    up(4):=0
    up(5):=250
    up(6):=200
    up(7):=100
    up(8):=400
    up(9):=25
    up(10):=0
    up(11):=175
    up(12):=200
    up(13):=300
    up(14):=400
    up(15):=0
    colourback (black)
    cls
    locate (5, 40)
    color (brightred)
    put "Welcome to Counter-Strike aim practise!"
    color (white)
    locate (6, 53)
    put "by Neil Martin"
    delay (1300)
    colour (brightgreen)
    locate (20, 40)
    put "Please make a selection"
    put "(1) Instructions"
    put "(2) Weapon Selection"
    put "(3) Exit Game"
    loop
        color (blue)
        getch (menu)
        if menu = "1" then
            cls
            color (white)
            put "You are on a Counter-Terrorist force!"
            put "Shoot all the terrorists you see."
            put "You only have a short time, so be quick!"
            put "A hit is worth 50 points and a headshot is worth 100 points!"
            put "A miss is -100 points, so make sure you shoot accurately."
            put "After you use all of your ammo in your clip press 'space' to reload"
            put "Good luck and have fun!"
            getch (key)
            menu := "2"
            cls
        elsif menu = "3" then
            Window.Close (winID)
        end if
        exit when menu = "2"
    end loop
    cls
    put "Please select your weapon!"
    put ""
    put ""
    put "(1) USP"
    put "(2) Deagle"
    put "(3) AK47"
    put "(4) To return to main menu"
    getch (gun)
    colorback (white)
    View.Set ("offscreenonly")
    if gun = "1" then
       
    loop
    cls
     for p: 1..15
     for q: 1..15
     Pic.ScreenLoad (usp, 830, -30, 0)
     Pic.ScreenLoad (ter1, over(p), up(q),0)
     View.Update
       mousewhere (x, y, button)   
        crosshair (x, y)
            View.Update
            cls
            Pic.ScreenLoad (usp, 830, -30, 0)
            Pic.ScreenLoad (ter1, over(p), up(q),0)
            View.Update
            if button = 1 then
                crosshair(x,y)
                delay(50)
                View.Update
                cls
                Pic.ScreenLoad (ter1, over(p), up(q),0)
                Pic.ScreenLoad (usp, 830, -30, 0)
                View.Update
                delay(50)
                cls
                Pic.ScreenLoad (ter1, over(p), up(q),0)
                Pic.ScreenLoad (usp1, 830, -30, 0)
                View.Update
                delay(50)
                cls
                Pic.ScreenLoad (ter1, over(p), up(q),0)
                Pic.ScreenLoad (usp2, 830, -30, 0)
                View.Update
                delay(50)
                cls
                Pic.ScreenLoad (ter1, over(p), up(q),0)
                Pic.ScreenLoad (usp3, 830, -30, 0)
                View.Update
                delay (50)
                cls
            end if
            View.Update
            delay(1500)
            cls
            end for
            end for
            end loop
    elsif gun = "2" then
        loop
            cls
            Pic.ScreenLoad (deagle, 752, -30, 0)
            mousewhere (x, y, button)
            crosshair (x, y)
            View.Update
            if button = 1 then
                cls
                Pic.ScreenLoad (deagle, 830, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (deagle1, 580, -30, 0)
                delay (50)
                View.Update
                cls
                Pic.ScreenLoad (deagle2, 690, -30, 0)
                delay (50)
                View.Update
                delay (50)
                cls
            end if
            View.Update
            end loop
    elsif gun = "3" then
        loop
            cls
            Pic.ScreenLoad (ak47, 500, -90, 0)
            mousewhere (x, y, button)
            if button = 1 then
                cls
                Pic.ScreenLoad (ak471, 500, -90, 0)
                View.Update
                delay (80)
                cls
            end if
            crosshair (x, y)
            View.Update
            end loop
        exit when gun = "4"
    end if
end loop


I really need the help here. Thanks in advance.
HKYPLAYA4LIFE




PostPosted: Sun May 23, 2004 5:15 pm   Post subject: (No subject)

Im going to try to explain this a bit better so I can get some help. After you select your gun I am trying to make the terrorist be draw for a a few seconds and in that time you can move the curso over the terrorist and shoot. When you shoot the gun does a little animation then the terrorist should reappear in a new spot. This loop as of right now is endless, but Im am going to make it so after about 2 minutes or so it adds up your score (all of which I havent got to yet because I cant get this shooting the terrorist problem worked out).
HKYPLAYA4LIFE




PostPosted: Sun May 23, 2004 8:33 pm   Post subject: (No subject)

How do I upload my pictures to the site, anyone?
HKYPLAYA4LIFE




PostPosted: Mon May 24, 2004 5:30 pm   Post subject: (No subject)

Pleaseeeee Im begging for help here... Im so screwed Sad
Cervantes




PostPosted: Mon May 24, 2004 5:45 pm   Post subject: (No subject)

to upload pictures attach them as a file: click on Add an Attachment and then browse for it, then attach it.

zip the pics and the code (.t file) and post that and we'll see whats going on.
Flashkicks




PostPosted: Tue May 25, 2004 8:01 am   Post subject: (No subject)

Is all that quadruple posting really neccesary??.......


Good Luck with the game.
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  [ 14 Posts ]
Jump to:   


Style:  
Search: