Bizarrely, it seems to only draw one of the lamps (alpha'd png images') and not the second. Then, if I change some of the values in my array assignment code (the second box in my OP), it 'hangs on' to the previously stated images? Here's the rest of my code so far for completeness - in a very 'test' state at the moment. (Thanks for looking!) :)
'---Heaven & Hell (Main)
'---28 January 2009
'---Version 0.01
Strict
Graphics 1024,768',32,60 remove the hyphen to enable fullscreen mode
SetBlend ALPHABLEND
Global gfx_screen:TImage=LoadImage("main.png") 'main machine glass
SetImageHandle gfx_screen,0,0
Global gfx_reela:TImage=LoadImage("reela.png") 'reel a image
SetImageHandle gfx_reela,0,0
Global gfx_reelb:TImage=LoadImage("reelb.png") 'reel b image
SetImageHandle gfx_reelb,0,0
Global gfx_reelc:TImage=LoadImage("reelc.png") 'reel c image
SetImageHandle gfx_reelc,0,0
Global gfx_lamps:TImage=LoadAnimImage("lamps.png",200,128,0,200) 'lamp images
SetImageHandle gfx_lamps,100,64
Global var_state:Int=0
'var_state values
'0=initialise
'1=introduction screen
'2=attract mode active
'3=play mode active
Global var_mainx:Int=0 'main x offset origin
Global var_mainy:Int=0 'main y offset origin
Type typ_lamp
Global x:Int=0 'lamp x position on the screen
Global y:Int=0 'lamp y position on the screen
Global lamp:Int=0 'lamp item identifier
Global state:Byte=0 'lamp on/off state
Global alpha:Byte=0 'lamp alpha level
Global alphadir:Byte=0 'lamp alpha direction (fade in / fade out)
End Type
Global arr_lamps:typ_lamp[2]
'populate lamp array with lamp information
arr_lamps[1].x=232
arr_lamps[1].y=602
arr_lamps[1].lamp=37
arr_lamps[2].x=601
arr_lamps[2].y=1154
arr_lamps[2].lamp=16
'--------------------------------------------------
Repeat
Cls
SetAlpha 1
fnc_reels()
SetViewport 0,0,1024,768
fnc_screen()
Flip
Until AppTerminate() Or KeyHit(KEY_ESCAPE)
'--------------------------------------------------
Function fnc_reels()
SetViewport 342,1237+var_mainy,97,250
TileImage gfx_reela,342,1237
SetViewport 463,1237+var_mainy,97,250
TileImage gfx_reelb,463,1237
SetViewport 587,1237+var_mainy,97,250
TileImage gfx_reelc,587,1237
End Function
Function fnc_screen()
If KeyDown(KEY_DOWN) And var_mainy>-768 Then var_mainy:-6
If KeyDown(KEY_UP) And var_mainy<0 Then var_mainy:+6
SetOrigin var_mainx,var_mainy
DrawImage gfx_screen,0,0
For Local a:Int=1 To 2
DrawImage gfx_lamps,arr_lamps[a].x,arr_lamps[a].y,arr_lamps[a].lamp
Next
End Function
Edit: It still only draws the 'latest' item in the array if I change the drawing routine to...
DrawImage gfx_lamps,arr_lamps[1].x,arr_lamps[1].y,arr_lamps[1].lamp
DrawImage gfx_lamps,arr_lamps[2].x,arr_lamps[2].y,arr_lamps[2].lamp
|