flashing screen

BlitzMax Forums/BlitzMax Beginners Area/flashing screen

In this example there are four images on the screen using data, image 1 is controlled by I,J,K,L

No Doubt in your game you will want more than one image

' -------------------- '
' Meltdown Source Code '
' Eric Vaughn 2006 '
' -------------------- '

' Maximum number of Sprites (Moveable objects)
Const maxSprite=10

Global Sprite[maxSprite+1],Sprite_alive[maxSprite+1]
Global Sprite_x[maxSprite+1],Sprite_y[maxSprite+1]


' Initialize Window

Graphics 400, 300, 16

HideMouse


' Load Images
i=0
Repeat
i=i+1
ReadData file$,Sprite_x[i],Sprite_y[i],Sprite_Alive[i]
Sprite[i] = LoadImage(file$) 
Until file$="end"

DefData "images/player.bmp",50,74,True
DefData "images/player.bmp",4,4,True
DefData "images/player.bmp",150,174,True
DefData "images/player.bmp",250,274,True
DefData "end",0,0,0



' Main Loop

While Not KeyHit(KEY_ESCAPE)

Cls

' Code to draw Backgroud goes here....

' Code to move Sprites goes here...
If KeyDown(KEY_J) And Sprite_x[1]>0 Then Sprite_x[1]=Sprite_x[1]-1
If KeyDown(KEY_L) And Sprite_x[1]<400 Then Sprite_x[1]=Sprite_x[1]+1
If KeyDown(KEY_I) And Sprite_x[1]>0 Then Sprite_y[1]=Sprite_y[1]-1
If KeyDown(KEY_K) And Sprite_x[1]<300 Then Sprite_y[1]=Sprite_y[1]+1




' Draw Images

For i = 1 To maxSprite
If Sprite_alive[i]=True
DrawImage(Sprite[i], Sprite_x[i], Sprite_y[i])
EndIf
Next

Flip
Wend