Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "FBGFX.BI"
- #include "STRING.BI"
- #include "BITMAP.BI"
- Using FB
- Const As Double pi = 3.1415926
- Const As Integer false = 0, true = Not false
- Const As Integer w = 1400, h = 800, full_screen = false, show_fps = true
- Const As Double target_frame_rate = 60
- Dim As Double frame_start, frame_length, game_timer, frames_per_second
- Dim As Integer frame_counter
- Screenres w, h, 32, 2, full_screen
- Screenset 0,1
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- ' DECLARATIONS ... Add anything you need here :)
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- Type Hat
- As Integer x,y,GID,Hat_Height
- End Type
- Dim HatImages(1 To 3) As Bitmap
- HatImages(1) = LoadBitmap("res/Bowler.bmp")
- Dim Bowler As Hat
- Bowler.GID = 1
- Bowler.Hat_Height = 28
- HatImages(2) = LoadBitmap("res/Fedora.bmp")
- Dim Fedora As Hat
- Fedora.GID = 2
- Fedora.Hat_Height = 41
- Dim As Integer Row, Speed
- Row = h/10
- Speed = 1
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- While Not Multikey(SC_ESCAPE)
- frame_start = Timer()
- If frame_length > 0 Then
- game_timer += frame_length
- frames_per_second = 1/frame_length
- End If
- Cls
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- ' INPUTS ... Anything the user can interact with
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- ' PROCESSES ... Where the 'thinking' takes place
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- Scope
- Dim As Integer i
- For i = 1 to 2
- If(Row < (h/10)*9) Then
- Speed += 1
- Row += Speed
- If Row > ((h/10)*9)- HatImages(i).Hat_Height Then
- Row = (h/10)*9 - HatImages(i).Hat_Height
- End If
- End If
- Next i
- End Scope
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- ' OUTPUTS ... Where everything is drawn
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- DrawBitmap(w/3, Row, HatImages(Bowler.GID))
- DrawBitmap(w/7, Row, HatImages(Fedora.GID))
- ' - - - - - - - - - - - - - - - - - - - - - - - - - -
- If show_fps Then
- Draw String (10,10), "FRAMES PER SECOND " + Format(frames_per_second, "0")
- Draw String (10,20), "FRAME LENGTH " + Format(frame_length*1000, "0.00") + "ms"
- Draw String (10,30), "GAME TIMER " + Format(game_timer, "0.00") + "s"
- Draw String (10,40), "GAME FRAMES " + Format(frame_counter, "0")
- End If
- Screencopy 0,1
- frame_counter += 1
- Do : frame_length = Timer() - frame_start
- Loop Until frame_length > 1/target_frame_rate
- Wend
- End
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement