Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

2D All the way! / I Searched But No Luck [DB Pro]

Author
Message
Game King
18
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Naples, FL
Posted: 4th Aug 2007 23:43 Edited at: 4th Aug 2007 23:44
I have Pasted Images that I want to change into a different image when the mouse cursor goes over it but no luck. Everything works fine if I click on the images it'll do what it needs to do, but they don't change into the other image.

Here's the source code if needed.
Quote: "
REM ** Main Menu File **
REM Vaelore And The Blight From The Wicked
REM Started On July 10, 2007

REM ~~~~~~~~~ Other ~~~~~~~~~~~~~~~~~~~

global MM_Init as boolean `Checks if the Main Menu has been loaded.
global In_Menu as boolean `Checks if player is still in the Main Menu.

REM ~~~~~~~ Coordinates ~~~~~~~~~~~~~~~

global MMBacx as word `X coor. for the Main Menu's Background.
global MMBacy as word `Y coor. for the Main Menu's Background.
global Beginx as word `X coor. for button "Begin".
global Beginy as word `Y coor. for button "Begin".
global Continuex as word `X coor. for button "Continue".
global Continuey as word `Y coor. for button "Continue".
global Unlockx as word `X coor. for button "Unlockables".
global Unlocky as word `Y coor. for button "Unlockables".
global Creditsx as word `X coor. for button "Credits".
global Creditsy as word `Y coor. for button "Credits".
global Exitx as word `X coor. for button "Exit".
global Exity as word `Y coor. for button "Exit".
global Mx as word `X coor. for the Cursor.
global My as word `Y coor. for the Cursor.
global Mc as Boolean `Left Click Boolean.

REM ~~~~~~~(Free AI) Names ~~~~~~~~~~~~

global img_MM_Background as word
global img_Begin_Button as word
global img_Begin_Button_Glow as word
global img_Continue_Button as word
global img_Continue_Button_Glow as word
global img_Unlock_Button as word
global img_Unlock_Button_Glow as word
global img_Credits_Button as word
global img_Credits_Button_Glow as word
global img_Exit_Button as word
global img_Exit_Button_Glow as word
global img_Icon as word
global img_Cursor_1 as word


REM ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Function Load_Menu()

In_Menu=1 `Tells the game you're in the Main Menu.
If MM_Init=0 and In_Menu=1 Then MM_Load()`If Main Menu is not loaded and In Menu is True then load Main Menu.

EndFunction

Function MM_Load()

Load_Menu_Background() `This will load the Main Menu's Background.
Menu_Button_Settings() `This will set the Main Menu's Buttons to custom settings.
Load_Custom_Cursor() `Loads the "Custom Cursor" Sprite.
Load_Menu_Music() `This will load the Main Menu Music.
Menu_Loop() `Calls the Main Menu's loop.
MM_Init=1 `Let's The Game Know That The Menu Has Been Loaded.

EndFunction

Function Load_Menu_Background()

MMBacx=80 `Set's the Main Menu's X Coordinate to 80
MMBacy=10 `Set's the Main Menu's Y Coordinate to 10
img_MM_Background= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Background.bmp", img_MM_Background,1 `Load the Image "Main Menu Background".

EndFunction

Function Load_Custom_Cursor()

img_Cursor_1= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Cursor_1.bmp", img_Cursor_1,1 `Loads "Normal" Image.

EndFunction

Function Menu_Button_Settings()

Beginx=650 `x Coordinate for the "Begin" Button.
Beginy=180 `y coordinate for the "Begin" Button.
img_Begin_Button= Free_Img_Number() `Assigns the variable to an Image number.
img_Begin_Button_Glow= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Begin Button.bmp", img_Begin_Button,1 `Loads "Normal" Image.
Load Image "media/Main Menu/Begin Button Glow.bmp", img_Begin_Button_Glow,1 `Loads "Normal" Image.

Continuex=650 `x Coordinate for the "Continue" Button.
Continuey=280 `y Coordinate for the "Continue" Button.
img_Continue_Button= Free_Img_Number() `Assigns the variable to an Image number.
img_Continue_Button_Glow= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Continue Button.bmp", img_Continue_Button,1 `Loads "Normal" Image.
Load Image "media/Main Menu/Continue Button Glow.bmp", img_Continue_Button_Glow,1 `Loads "Normal" Image.

Unlockx=650 `x Coordinate for the "Unlock" Button.
Unlocky=380 `y Coordinate for the "Unlock" Button.
img_Unlock_Button= Free_Img_Number() `Assigns the variable to an Image number.
img_Unlock_Button_Glow= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Unlockables Button.bmp", img_Unlock_Button,1 `Loads "Glow" Image.
Load Image "media/Main Menu/Unlockables Button Glow.bmp", img_Unlock_Button_Glow,1 `Loads "Glow" Image.

Creditsx=650 `x Coordinate for the "Credits" Button.
Creditsy=480 `y Coordinate for the "Credits" Button.
img_Credits_Button= Free_Img_Number() `Assigns the variable to an Image number.
img_Credits_Button_Glow= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Credits Button.bmp", img_Credits_Button,1 `Loads "Normal" Image.
Load Image "media/Main Menu/Credits Button Glow.bmp", img_Credits_Button,1 `Loads "Normal" Image.

Exitx=650 `x Coordinate for the "Exit" Button.
Exity=580 `y Coordinate for the "Exit" Button.
img_Exit_Button= Free_Img_Number() `Assigns the variable to an Image number.
img_Exit_Button_Glow= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/Exit Button.bmp", img_Exit_Button,1 `Loads "Glow" Image.
Load Image "media/Main Menu/Exit Button Glow.bmp", img_Exit_Button_Glow,1 `Loads "Glow" Image.

img_Icon= Free_Img_Number() `Assigns the variable to an Image number.
Load Image "media/Main Menu/DG.bmp", img_Icon,1 `Load the Image "DG Icon".

EndFunction

Function Menu_Loop()

Do `Goes to "Loop".
Mx=MouseX():My=Mousey():Mc=Mouseclick() `Variables "Mx and My" are set to mouse coor. "Mc" is the clicks.

CLS RGB(0, 0, 0) `Clears the Background to the colour Black.

Paste Image img_MM_Background,80,15,1 `Pastes Sprite "Main Menu Background" to it's Coordinates.

Paste Image img_Icon,685,30,1 `Pastes Sprite "Icon" to it's Coordinates.


If In_Menu=1 and Mx> 670 and My> 190 and Mx<822 and My<260 and Mc=1` If all of these Vs are True then:
New_Game() `Calls the Function that starts a New Game.
EndIf

If In_Menu=1 and Mx> 670 and My> 190 and Mx<822 and My<260 `If all of these Vs are True then:
Paste Image img_Begin_Button_Glow,Beginx,Beginy,1`Pastes "Begin Button" at it's Coordinates.
Else
Paste Image img_Begin_Button,Beginx,Beginy,1 `Pastes "Begin Button" at it's Coordinates.
EndIf


If In_Menu=1 and Mx>670 and My>290 and Mx<822 and My<360 and Mc=1`If all of these Vs are True then:
Load_Game() `Calls the Function that starts the Loading Section.
EndIf


If In_Menu=1 and Mx> 670 and My> 290 and Mx<822 and My<360 `If all of these Vs are True then:
Paste Image img_Continue_Button_Glow,Continuex,Continuey,1`Pastes "Continue Button" at it's Coordinates.
Else
Paste Image img_Continue_Button ,Continuex,Continuey,1 `Pastes "Continue Button" at it's Coordinates.
EndIf


If In_Menu=1 and Mx>670 and My>390 and Mx<822 and My<460 and Mc=1 `If all of these Vs are True then:
Unlockables() `Calls the Function that starts the Unlockables Section.
EndIf


If In_Menu=1 and Mx> 670 and My> 390 and Mx<822 and My<460 `If all of these Vs are True then:.
Paste Image img_Unlock_Button_Glow,Unlockx,Unlocky,1`Pastes "Unlock Button" at it's Coordinates.
Else
Paste Image img_Unlock_Button,Unlockx,Unlocky,1`Pastes "Unlock Button" at it's Coordinates.
EndIf


If In_Menu=1 and Mx>670 and My>490 and Mx<822 and My<560 and Mc=1 `If all of these Vs are True then:
Credits() `Calls the Function that starts the Credits Section.
EndIf


If In_Menu=1 and Mx> 670 and My> 490 and Mx<822 and My<560 `If all of these Vs are True then:
Paste Image img_Credits_Button_Glow, Creditsx, Creditsy,1`Pastes "Credits Button" at it's Coordinates.
Else
Paste Image img_Credits_Button, Creditsx, Creditsy,1 `Pastes "Credits Button" at it's Coordinates.
EndIf


If In_Menu=1 and Mx>670 and My>590 and Mx<822 and My<685 and Mc=1 `If all of these Vs are True then:
End `Exits the Game.
EndIf

If In_Menu=1 and Mx> 670 and My> 590 and Mx<822 and My<685 `If all of these Vs are True then:
Paste Image img_Exit_Button_Glow, Exitx, Exity,1 `Pastes "Exit Button" at it's Coordinates.
Else
Paste Image img_Exit_Button, Exitx, Exity,1 `Pastes "Exit Button" at it's Coordinates.
EndIf

Paste Image img_Cursor_1,Mx,My,1 `Pastes Sprite "Cursor_1" to it's Coordinates.

Print str$(Screen FPS()) `Prints the Game's Frames Per Second.
Sync `Refreshes the Screen.
Loop `Goes back to "Do".

EndFunction


Function Load_Menu_Music()

`Loads the Main Menu's Music.

EndFunction"


vorconan
18
Years of Service
User Offline
Joined: 4th Nov 2006
Location: Wales
Posted: 5th Aug 2007 01:47
A little tip I learnt from Cash Curtis, place a single sprite pixel constantly on the mouse position, then check for collision between the mouse sprite and the one you want to change.


Game King
18
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Naples, FL
Posted: 5th Aug 2007 02:00
Thanks for the tip but the collision with the buttons I don't need help with. I don't know how change an Image that I have pasted.

Game King
18
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Naples, FL
Posted: 5th Aug 2007 19:38 Edited at: 5th Aug 2007 19:38


^^That's the new code, but it doesn't change the sprite! it just make it disappear..

Game King
18
Years of Service
User Offline
Joined: 25th Mar 2007
Location: Naples, FL
Posted: 6th Aug 2007 22:38
Ok Problem fixed thnx WindowsKiller, and anybody else.

Login to post a reply

Server time is: 2025-08-09 02:10:07
Your offset time is: 2025-08-09 02:10:07