Computer Science Canada

Pictures in a program?

Author:  skatelhs [ Thu May 29, 2003 12:44 pm ]
Post subject:  Pictures in a program?

hi, im making a game. I want to have a picture show by my crosshair when you click, but I dont know how to put one in and I dont want to use 100 different drawline commands to make it. Im talking about one of those spark-lookin things that comes out of the end of your gun when you shoot. heres the code if you want to see what ive got so far
code:

View.Set ("offscreenonly")
var x, y, button, bulletsleft : int := 0

bulletsleft := 8

loop
    %Bullets Left- Shown at the Top
    locate (1, 1)
    put "There are ", bulletsleft, " bullets left in the Clip"
    %Crosshair
    drawfillbox (x - 15, y - 1, x + 15, y + 1, white)
    drawfillbox (x - 1, y - 15, x + 1, y + 15, white)
    Mouse.Where (x, y, button)
    if button = 1 and bulletsleft > 0 then
        bulletsleft := bulletsleft - 1
        Music.PlayFile ("gunshot.wav")
    else
        %notshooting
        drawfillbox (x - 15, y - 1, x + 15, y + 1, brightblue)
        drawfillbox (x - 1, y - 15, x + 1, y + 15, brightblue)
        View.Update
        delay (10)

    end if
    if bulletsleft <= 0 then
        bulletsleft := 0
    end if
end loop

so please let me know how to do that, thanks.

Author:  Tony [ Thu May 29, 2003 4:41 pm ]
Post subject: 

I'm preaty sure we already have a tutorial on how to load picture in your program... a short summary would be
code:

var pidID:int := Pic.FileNew("c:\picture.jpg")
Pic.Draw(picID,x,y,picCopy)


: