Hi all,
My fruit machine project is coming on quite nicely, but I'm struggling getting my head around something to do with the placement of images which I want to 'overlay' my main image.
The main graphic is 1024x1536, which is normally handled and drawn at 0,0. You can scroll down to the bottom and up to the top via the arrow keys.
I now want to place some items that appear on top of this graphic. Some items will start of screen, of course (on the bottom 768 pixels that are only seen when you scroll down) and I can't seem to get the co-ordinates right for these items - it works OK for items that start 'on screen' however, but ideally, I'd want something that works for all items.
Here's my code so far, please note that this will be 'thrown away' after use, so it may be scrappy, I just wanted to utilise it to work out the co-ordinates for all the 130-odd 'lamps' that I need to paste over the main image. I hope this makes sense!
If you need me to explain further, please just let me know... ;)
Cheers,
M
My fruit machine project is coming on quite nicely, but I'm struggling getting my head around something to do with the placement of images which I want to 'overlay' my main image.
The main graphic is 1024x1536, which is normally handled and drawn at 0,0. You can scroll down to the bottom and up to the top via the arrow keys.
I now want to place some items that appear on top of this graphic. Some items will start of screen, of course (on the bottom 768 pixels that are only seen when you scroll down) and I can't seem to get the co-ordinates right for these items - it works OK for items that start 'on screen' however, but ideally, I'd want something that works for all items.
Here's my code so far, please note that this will be 'thrown away' after use, so it may be scrappy, I just wanted to utilise it to work out the co-ordinates for all the 130-odd 'lamps' that I need to paste over the main image. I hope this makes sense!
'---Heaven & Hell (Lamp Locator) '---27 January 2009 '---Version 0.01 Graphics 1024,768 SetBlend ALPHABLEND HideMouse Global gfx_main=LoadImage("main.png") SetImageHandle gfx_main,0,0 Global gfx_lamps=LoadAnimImage("lamps.png",200,128,0,140) SetImageHandle gfx_lamps,100,64 Global var_screenx=0 Global var_screeny=0 Global var_lampcount=137 Global var_lamp=0 Global var_alpha#=1 Global var_alphadir=0 Repeat SetClsColor 255,255,255 Cls If KeyDown(KEY_DOWN) And var_screeny>-768 Then var_screeny:-2 If KeyDown(KEY_UP) And var_screeny<0 Then var_screeny:+2 SetAlpha 1 DrawImage gfx_main,var_screenx,var_screeny If KeyHit(KEY_EQUALS) Then If var_lamp<137 Then var_lamp:+1 Else var_lamp=0 End If End If If KeyHit(KEY_MINUS) Then If var_lamp>0 Then var_lamp:-1 Else var_lamp=137 End If End If If MouseDown(1) Then If var_alpha>0 And var_alphadir=0 Then var_alpha:-0.02 End If If var_alpha=<0 Then var_alphadir=1 If var_alpha<1 And var_alphadir=1 Then var_alpha:+0.02 End If If var_alpha=>1 Then var_alphadir=0 SetAlpha var_alpha End If DrawImage gfx_lamps,MouseX(),MouseY(),var_lamp SetAlpha 1 DrawText MouseX(),0,0 DrawText MouseY()+var_screeny,0,12 DrawText var_screenx,0,24 DrawText var_screeny,0,36 Flip Until KeyHit(KEY_ESCAPE)
If you need me to explain further, please just let me know... ;)
Cheers,
M