This one has moving Images and One controlled by the keyboard... The basics of any game.
I have tested this in BMAX, it should only need the brackets changed with the arrays to make it work in B3D.
I have tested this in BMAX, it should only need the brackets changed with the arrays to make it work in B3D.
' -------------------- ' ' 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] Global Sprite_x_d[maxSprite+1],Sprite_y_d[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_x_d[i],Sprite_y_d[i],Sprite_Alive[i] Sprite[i] = LoadImage(file$) Until file$="end" DefData "images/player.bmp",50,74,0,0,True DefData "images/player.bmp",4,4,1,0,True DefData "images/player.bmp",150,174,-1,1,True DefData "images/player.bmp",250,274,0,1,True DefData "end",0,0,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 ' Exclude Player 1 from moving here if you want If i>1 Sprite_x[i]=Sprite_x[i]+Sprite_x_d[i] Sprite_y[i]=Sprite_y[i]+Sprite_y_d[i] If Sprite_x[i]<0 Sprite_x[i]=0 Sprite_x_d[i]=0.0-Sprite_x_d[i] EndIf If Sprite_y[i]<0 Sprite_y[i]=0 Sprite_y_d[i]=0.0-Sprite_y_d[i] EndIf If Sprite_x[i]>400 Sprite_x[i]=400 Sprite_x_d[i]=0.0-Sprite_x_d[i] EndIf If Sprite_y[i]>300 Sprite_y[i]=300 Sprite_y_d[i]=0.0-Sprite_y_d[i] EndIf EndIf DrawImage(Sprite[i], Sprite_x[i], Sprite_y[i]) EndIf Next Flip Wend