https://qb64phoenix.com/forum/showthread...4#pid30124
(It's reply #6 if you are dropped to bottom of page on links like I am in this forum.)
If @TempodiBasic can't figure it out then maybe other people could use help too...
Basic setup for playing a game over a very large background. Use arrow keys to move over background in that direction. If you stop, you have gone to edge of background.
Of course you can do this step by step too with the arrow keys.
(It's reply #6 if you are dropped to bottom of page on links like I am in this forum.)
If @TempodiBasic can't figure it out then maybe other people could use help too...
Basic setup for playing a game over a very large background. Use arrow keys to move over background in that direction. If you stop, you have gone to edge of background.
Code: (Select All)
_Title "Image bigger than screen" ' b+ 2024-12-02
Randomize Timer
Screen _NewImage(800, 600, 32)
_ScreenMove 100, 20
Dim bg&
bgw = 1600 ' double width and height for demo
bgh = 1200
bg& = _NewImage(bgw, bgh, 32)
_Dest bg&
For i = 1 To 80
Line (Rnd * bgw, Rnd * bgh)-Step(Rnd * 100 + 50, Rnd * 75 + 25), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), BF
Next
_Dest 0
d = 0: e = 0
While _KeyDown(27) = 0
Cls
k = _KeyHit
If k = 19200 Then d = -1: e = 0 ' left
If k = 19712 Then d = 1: e = 0 ' right
If k = 18432 Then e = -1: d = 0 ' up
If k = 20480 Then e = 1: d = 0 'down
top = top + e
If top < 0 Then top = 0
If top + _Height > bgh Then top = bgh - _Height
le = le + d
If le < 0 Then le = 0
If le + _Width > bgw Then le = bgw - _Width
_PutImage (0, 0)-(_Width, _Height), bg&, 0, (le, top)-(le + _Width, top + _Height)
_Display
_Limit 120
Wend
Of course you can do this step by step too with the arrow keys.
Code: (Select All)
_Title "Step through Image bigger than screen" ' b+ 2024-12-02
Randomize Timer
Screen _NewImage(800, 600, 32)
_ScreenMove 100, 20
Dim bg&
bgw = 1600 ' double area for demo
bgh = 1200
bg& = _NewImage(bgw, bgh, 32)
_Dest bg&
For i = 1 To 80
Line (Rnd * bgw, Rnd * bgh)-Step(Rnd * 100 + 50, Rnd * 75 + 25), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), BF
Next
_Dest 0
stepper = 5 ' <<< set step size here!!!
While _KeyDown(27) = 0
Cls
k = _KeyHit
If k = 19200 Then ' left
If le - stepper >= 0 Then le = le - stepper
End If
If k = 19712 Then ' right
If le + stepper <= bgw - _Width - 1 Then le = le + stepper
End If
If k = 18432 Then ' up
If top - stepper >= 0 Then top = top - stepper
End If
If k = 20480 Then 'down
If top + stepper <= bgh - _Height - 1 Then top = top + stepper
End If
_PutImage (0, 0)-(_Width, _Height), bg&, 0, (le, top)-(le + _Width, top + _Height)
_Display
_Limit 120
Wend
b = b + ...