
-----------------------------------
alexcaz
Tue Jan 23, 2007 9:39 pm

crosshair, whitespace around image and collision problems [URGENT!!]
-----------------------------------
i am making this game called hold the beach, since i didnt have time to do real 3d graphics engine, i cheated and used a special circular picture as a background for the 3d effect, the gun is also stationary in one position to save myself some trouble. right now the crosshair is drawn in green at the center of the screen (permantely), i am using Mouse.where to move the background so that if you move your mouse to the right then the background follows you, but the mouse cursor moves faster than the screen for some reason, and now the crosshair is still in the middle but the mouse cursor is like at the end of the screen, (making collision more difficult to make. could anyone please explain to me how would i be able to get the cursor and crosshair moving at the same speed and all stay in the middle (like doom), this is very urgent so will anyone that has any solution or idea please post a reply??!! thank you all who replies in advance my code is as followed:


import GUI
Music.PlayFileLoop ("maintheme.mp3")
const screenWidth : int := Config.Display (cdScreenWidth)
const screenHeight : int := Config.Display (cdScreenHeight)
var windowID : int := 0
var helpg := Pic.FileNew ("controls.jpg")
var helpg2 := Pic.FileNew ("keyboard.jpg")
var backg := Pic.FileNew ("Beach.jpg")
var mblt1 := Pic.FileNew ("mblt1.jpg")
var mblt2 := Pic.FileNew ("mblt2.jpg")
var mblt3 := Pic.FileNew ("mblt3.jpg")
var beach := Pic.FileNew ("beach3large.jpg")
var ammo := Pic.FileNew ("ammo.jpg")
var shield := Pic.FileNew ("health.jpg")
var gun2 := Pic.FileNew ("machinegun.jpg")
var gun := Pic.FileNew ("mgun.jpg")
var bullet := Pic.FileNew ("bullet.jpg")
var soldi : array 0 .. 25 of int
soldi (0) := Pic.FileNew ("soldierss.jpg")
var x1, y1, button1 : int := 0
var x2, y2 : int := 0
var x4, y4, x3, y3, button2 : int
Pic.SetTransparentColor (bullet, black)
Pic.SetTransparentColor (gun, 0)
process shot
    Music.PlayFile ("machinegun.wav")
end shot
proc cross
    drawoval (335, 300, 8, 8, brightgreen)
    drawline (327, 300, 343, 300, brightgreen)
    drawline (335, 292, 335, 308, brightgreen)
    drawdot (335, 300, brightred)
end cross
proc backgrounds
    x1 := x1 - 1500
    y1 := y1 - 800
    Pic.Draw (shield, 20, 500, picMerge)
    Pic.Draw (ammo, 20, 20, picMerge)
    cross
    View.Update
end backgrounds
var ht : int := 75
procedure mblts
    loop
        delay (100)
        Pic.Draw (mblt1, 650, ht, picMerge)
        delay (300)
        Pic.Draw (mblt2, 685, ht + 25, picMerge)
        delay (300)
        Pic.Draw (mblt3, 620, ht - 5, picMerge)
        delay (150)
        View.Update
        exit
    end loop
end mblts
proc maingame
    loop
        View.Update
        Mouse.Where (x4, y4, button2)
        loop
            Pic.Draw (beach, -x4 - 300, -y4 - 180, picCopy)
            Pic.Draw (gun, 350, -50, picMerge)
            exit
        end loop
        Mouse.Where (x1, y1, button1)
        x2 := x2 + 0
        y2 := y2 - 1
        backgrounds
        Pic.Draw (soldi (0), x1 - 1500, y1 - 800, 3)
        if button1 = 1 then
            loop
                fork shot
                Pic.Draw (bullet, 350, 200, picMerge)
                delay (100)
                Pic.Draw (mblt1, 600, 85, picXor)
                View.Update
                delay (100)
                Pic.Draw (mblt2, 635, 110, picXor)
                View.Update
                delay (100)
                Pic.Draw (mblt3, 680, 105, picXor)
                View.Update
                exit
            end loop
        else
            delay (20)
        end if
    end loop
end maingame
var x, y, button : int
windowID := Window.Open ("title:Window #" +
    intstr (0) + ",graphics:" +
    intstr (150) + ";" + intstr (100) +
    ",position:" + intstr (50) + ";" + intstr (50))
setscreen ("graphics:640;480,offscreenonly,position:center;center")
loop
    var quitButton : int := GUI.CreateButton (530, 450, 0, "EXIT GAME", GUI.Quit)
    Pic.Draw (backg, 0, 0, 0)
    View.Update
    loop
        Mouse.Where (x, y, button)
        if button = 1 and x >= 288 and x = 21 and y = 424 and x = 22 and y = 458 and y >= 55 and x = 55 and y = 55 and y = 55 and y 