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

Username:   Password: 
 RegisterRegister   
 crosshair, whitespace around image and collision problems [URGENT!!]
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
alexcaz




PostPosted: Tue Jan 23, 2007 9:39 pm   Post subject: 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:

code:

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 <= 353 and y >= 21 and y <= 45 then
            cls
            var zz : int := 1
            for i : 1 .. 100
                delay (50)
                Draw.FillBox (100, 15, 100 + zz, 25, 54)
                Draw.Box (100, 15, 200, 25, 1)
                zz := zz + 1
                locate (23, 13)
                View.Update
                put "Loading... ", zz, "%" ..
            end for
            locate (23, 13)
            put "Done Loading!   " ..
            View.Update
            delay (500)
            colorback (white)
            delay (300)
            Music.PlayFileStop
            cls
            View.Set ("graphics:max;max,position:center;center,offscreenonly,noecho")
            Pic.Draw (beach, 750, 630, 0)
            loop
                Mouse.Where (x1, y1, button1)
                maingame
                delay (20)
                View.Update
            end loop
            exit
        elsif button = 1 and x >= 424 and x <= 483 and y >= 22 and y <= 43
                then
            Pic.Draw (helpg, 0, 0, 0)
            View.Update
            loop
                loop
                    Mouse.Where (x, y, button)
                    if button = 1 and x >= 458 and y >= 55 and x <= 516 and y <= 76
                            then
                        Pic.Draw (helpg2, 0, 0, 0)
                        View.Update
                        loop
                            Mouse.Where (x, y, button)
                            if button = 1 and x >= 106 and y >= 55 and y <= 77 and x <= 163
                                    then
                                Pic.Draw (helpg, 0, 0, 0)
                                View.Update
                                exit
                            end if
                        end loop
                    elsif button = 1 and x >= 548 and x <= 605 and y >= 455 and y <= 480
                            then
                        exit
                    elsif button = 1 and x >= 106 and y >= 55 and y <= 77 and x <= 163
                            then
                        Pic.Draw (backg, 0, 0, 0)
                        View.Update
                        exit
                    end if
                    exit when button = 1 and x >= 106 and y >= 55 and y <= 77 and x <= 163
                end loop
                Pic.Draw (backg, 0, 0, 0)
                exit
            end loop
            View.Update
        elsif button = 1 and x >= 548 and x <= 605 and y >= 455 and y <= 480
                then
            exit
        end if
    end loop
    exit
end loop
loop
    exit when GUI.ProcessEvent
end loop
if windowID not= 0 then
    GUI.CloseWindow (windowID)
end if
GUI.CloseWindow (windowID)



There is also large amounts of white space around the pictures, i can't seem to be able to fix it would anyone be kind enough to fix it for me or explain how to fix it to me? The soldiers dont yet pop up and walk down, if anyone would explain to me how that will be very much appretiated

See attachment for pictures, music and the source codes



Game2.rar
 Description:

Download
 Filename:  Game2.rar
 Filesize:  1.55 MB
 Downloaded:  99 Time(s)

Sponsor
Sponsor
Sponsor
sponsor
Xianxin




PostPosted: Tue Jan 23, 2007 9:44 pm   Post subject: Re: crosshair, whitespace around image and collision problems [URGENT!!]

Lmao, Alex. I'd laugh if someone steals your program and hands it in tomorrow. For the white problem, I have the same problem for my Knight since it's not actually coloured white. spearmonkey2000's solution is to colour that area white.
alexcaz




PostPosted: Tue Jan 23, 2007 10:21 pm   Post subject: Re: crosshair, whitespace around image and collision problems [URGENT!!]

yo wayne doesnt matter eh, if they did, i'll just give shantz this lol. its proof. and y the heck u talking on here for. thats wat msn's for lol. where the white thing it doesnt work for mine for some reason
CodeMonkey2000




PostPosted: Wed Jan 24, 2007 9:07 pm   Post subject: Re: crosshair, whitespace around image and collision problems [URGENT!!]

I think there is something wrong with JPEG. Try saving it as a bitmap, and then fill in the white spaces in Ms paint. In your main program, change the name from mgun.jpeg to mgun.bmp. I tried to fix up your gun, youll need to finish the rest.
alexcaz




PostPosted: Thu Feb 01, 2007 11:12 am   Post subject: Re: crosshair, whitespace around image and collision problems [URGENT!!]

well thanks, but its a bit late now... had to hand it in like a week ago lol. anyways anyone wana help me finish 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  [ 5 Posts ]
Jump to:   


Style:  
Search: