Welcome Guest ( Log In | Register )

[ Big| Medium| Small] -



Post new topic Reply to topic  [ 1 post ] 
    Tev
  Fri Aug 13, 2010 12:19 am
User avatar
Member

In this thread I will post my Game Maker scripts. I am pretty new to code, but this is something I enjoy to do.

It may only be a simple script but I use it so often, I thought it may be of use to others. Even people who don't know how to code should be able to understand it.

To properly use it you have to have three sub-images for the sprite of the button. The first one should be when the button isn't being hovered over the second one should be when it is. The third one should be when the button is pressed.

CREATE EVENT:
Sets the speed the sprite plays through its sub images to 0. also sets the image the sprite displays at the start to 0.

Quote:
image_speed=0
image_index=0



STEP EVENT:
The first part just checks whether or not the button is touching the mouse cursor. If it is it changes the sub-image to 2. If not it changes the sub-image to 0.
The second parts checks to see if it's being clicked by the left mouse button. If it is it changes the sub-image to 3.

Quote:
if position_meeting(mouse_x,mouse_y,(self))
{
image_index=1
}
else
{
image_index=0
}

if mouse_check_button_pressed(mb_left)
{
image_index=2
}


I know it's fairly simple but I thought I'd contribute to the section considering it's pretty bland so far...


Top Top
Profile      
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

We are an independent, not-for-profit game making community.
Homepage
Board Index
About Us
Downloadable Games
Free Browser Games
Games in Development
RPG Maker Support
Game Maker Support
Construct 2 Support
HBGames the eZine
Advanced RPG Maker
Site Announcements
Powered by phpBB © phpBB Group