
-----------------------------------
alexcaz
Mon Jan 22, 2007 8:37 pm

collision detection and movement questions
-----------------------------------
Here is my Code, sorry about the loading screen, its not mine i'll get it changed as soon as i can. 

import GUI
Music.PlayFileLoop ("H:/Game/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 ("H:/Game/mblt1.jpg")
var mblt2 := Pic.FileNew ("H:/Game/mblt2.jpg")
var mblt3 := Pic.FileNew ("H:/Game/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 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
proc cross
    drawoval (325, 300, 8, 8, brightgreen)
    drawline (317, 300, 334, 300, brightgreen)
    drawline (325, 292, 325, 308, brightgreen)
    drawdot (325, 300, brightred)
end cross
proc backgrounds
    Pic.SetTransparentColor (gun, 0)
    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)
        View.Update
        delay (150)
        exit
    end loop
end mblts
proc maingame
    View.Set ("graphics:max;max,position:center;center,offscreenonly,noecho")
    loop
        View.Update
        Mouse.Where (x4, y4, button2)
        x3 := x4
        y3 := y4
        loop
            View.Update
            Pic.Draw (beach, -x3 - 300, -y3 - 180, picCopy)
            Pic.Draw (gun, 350, -50, picMerge)
            exit
        end loop
        View.Update
        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
                delay (100)
                Pic.Draw (mblt1, 700, 85, 2)
                View.Update
                delay (100)
                Pic.Draw (mblt2, 735, 110, 2)
                View.Update
                delay (100)
                Pic.Draw (mblt3, 780, 105, 2)
                View.Update
                delay (75)
                delay (10)
                View.Update
                exit
            end loop
        else
            delay (20)
            View.Update
        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 