Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a little tutorial STEP by STEP on scrolling in 2D graphic mode
#6
(12-01-2024, 10:53 PM)bplus Wrote: Background image BIGGER than the display screen:
Code: (Select All)
_Title "Image bigger than screen" ' b+ 2024-12-30
Randomize Timer
Screen _NewImage(800, 600, 32)
_ScreenMove 100, 20

Dim bg&
bgw = 2400
bgh = 600
bg& = _NewImage(bgw, bgh, 32)
_Dest bg&
For i = 1 To 100
    Line (Rnd * bgw, Rnd * bgh)-Step(Rnd * 100 + 50, Rnd * 75 + 25), _RGB32(Rnd * 255, Rnd * 255, Rnd * 255), BF
Next
_Dest 0
d = 1
While _KeyDown(27) = 0
    Cls
    k$ = UCase$(InKey$)
    If k$ = "A" Then d = -1
    If k$ = "D" Then d = 1
    If d Then
        If le + 800 > bgw Then
            d = -d
            te = bgw - le
            _PutImage (0, 0)-(te, bgh), bg&, 0, (bgw - te, 0)-(bgw, bgh)
            _PutImage (te, 0)-(800, bgh), bg&, 0, (0, 0)-(800 - te, bgh)
            Beep
        Else
            _PutImage (0, 0)-(800, bgh), bg&, 0, (le, 0)-(le + 800, bgh)
        End If
    End If
    le = le + d
    If le < 0 Then le = 0: d = -d: Beep
    _Display
    _Limit 120
Wend

This is just left and right, A and D, maybe @TempodiBasic can add up and down?
@Bplus
Hi man
so you're using filled rectangles into your BIGGER image!
And what? Do you like put the scrolling working in automation, it does not matter about user input! 
These concepts are over mine knowledge so I cannot UP/DOWN scrolling.
Buuut if you add this you can add to this  scrolling  the stop & go feature like the ecological car.

Code: (Select All)

S = 1
while _keydown(27) = 0
...
...
IF k$ = "S" THEN S = S * -1
...
....
...
IF S>0 THEN le = le +d
...
...
wend
Rolleyes
Reply


Messages In This Thread
RE: a little tutorial STEP by STEP on scrolling in 2D graphic mode - by TempodiBasic - 12-02-2024, 12:08 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  request for printing patterns with for loops tutorial fistfullofnails 24 4,344 08-19-2025, 08:09 PM
Last Post: bplus
  a little tutorial demo for Windows in SCREEN 0 TempodiBasic 0 597 12-10-2024, 01:00 AM
Last Post: TempodiBasic
  Portable Version of Terry Ritchie's Tutorial Updated mpgcan 6 5,853 09-22-2024, 09:13 PM
Last Post: TerryRitchie
  Steve's basic SIN/COS Tutorial SMcNeill 5 1,847 07-12-2024, 06:53 PM
Last Post: vince
  BIG QB64 Tutorial update TerryRitchie 4 1,542 05-22-2024, 06:20 PM
Last Post: TerryRitchie

Forum Jump:


Users browsing this thread: 1 Guest(s)