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.

DarkBASIC Discussion / Bit Image Positioning

Author
Message
Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 2nd Jan 2006 04:21
2 questions here...

What is the best way to make buttons light up as you press a key..?
For Eg: you have 2 pictures... one with a light bulb "on" one with a light bulg "off"... then you want a light bulb on the screen and you want it to light up when you hit the space bar... and go off when its released...

Question #"2" is how Can I position "Bit Image" like on the X and Y axis...?
thanx for any help...

Dexter

Who Dey Bengals
Dodic
19
Years of Service
User Offline
Joined: 6th Nov 2005
Location: SNM (Serbia&Montenegro)
Posted: 2nd Jan 2006 04:34
1st question : load image for normal button , make one sprite , and put as the space key is pressed , load image for new button (pressed) .



i hope i didn`t just confuzed you ....


Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 2nd Jan 2006 05:51 Edited at: 2nd Jan 2006 05:52
The best way is to just load both images or make one bitmap and grab the images, make a sprite using a variable for the image number used for the sprite, and make an if/then statement to change the variable.



In the command "sprite 1,0,0,CSprite" the two zeros are the x and y coordinates. If you just change those numbers the bulb can be anywhere on the screen.

You can do the following to make the sprite follow the mouse (this is perfect to make your own mice... just add "hide mouse" at the top of your code if you don't want to see the normal mouse):


Edit: Just in case you don't notice... the image loaded in this code snip is attached to this message... just hit the download button in the lower right of this box.


Attachments

Login to view attachments
Pincho Paxton
22
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 2nd Jan 2006 10:16
There's a program called DB Builder that saves the X/Y positions of buttons to make things easier.

Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 4th Jan 2006 05:25
thanx I got it.. one other thing..
say I got an Image thats 1600 x 600 and my scren display is set for 800 x 600 can i get an im age past 800?

for example

because its been saying my imaged grabed was too small...

Who Dey Bengals
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 4th Jan 2006 07:18 Edited at: 4th Jan 2006 07:19
If you just use:


Then it's going to load it on bitmap zero... which is the main screen. The default size of the main screen is 640x480.

You need either do this:


Or if that bitmap is one single image (which it sounds like it is) do this:


Using "load image" is both "load bitmap" and "get image" all in one command.


Dexter
19
Years of Service
User Offline
Joined: 4th Nov 2005
Location: Ohio
Posted: 5th Jan 2006 04:05
thanx game taking shape...

Dex

Who Dey Bengals

Login to post a reply

Server time is: 2025-05-22 23:41:42
Your offset time is: 2025-05-22 23:41:42