Hi,
First, you have to use 2D screen to that kind of effect
In that exemple, i create a 50x100 sprite
In there i draw
SCORE (x0 y0)
SCORE + 1 (x0 y50)
So i have a sprite with 0 and 1
The idea is that each time you press right arrow, i move the sprite to -1 Y
You can show the scroll effect 0 to 1
If Y = -50
I redraw the sprite withe the new score.
It may have easier solution but i have not really the time to help you more.
Code: Select all
Enumeration
#WIN
#FontC
EndEnumeration
Enumeration Sprites
#UNI
EndEnumeration
UsePNGImageDecoder()
Global FontC = LoadFont(#FontC, "courier new", 34)
; INITIALISATION
Global LWIN = 800, HWIN = 600, Pos,Uni
Global SC_UNI
InitSprite() : InitKeyboard()
Procedure CreateTextSprite()
Uni = CreateSprite(#UNI, 50,100)
SC_UNI = 0
EndProcedure
Procedure DrawScore()
StartDrawing(SpriteOutput(#UNI))
DrawingMode(#PB_2DDrawing_Transparent)
Box(0,0,50,100,$0)
DrawingFont(FontC)
DrawText(0,0,Str(SC_UNI),$FFFFFF,$0)
DrawText(0,50,Str(SC_UNI+1),$FFFFFF,$0)
StopDrawing()
EndProcedure
Procedure ShowScore()
ClipSprite (#UNI,0,pos,50,50)
DisplayTransparentSprite(#UNI, 0, 0, 255)
EndProcedure
Procedure AnimSprite()
; Animation
ClipSprite (#UNI,0,pos,50,50)
Pos + 1
If Pos = 50
SC_UNI+1
If SC_UNI = 10 : Sc_Uni = 0 : Endif
pos = 0
DrawScore()
EndIf
DisplayTransparentSprite(#UNI, 0, Pos, 255)
;///////////////////////////////////////
EndProcedure
Procedure GOWINDOW()
OpenWindow(#WIN,0,0,Lwin, Hwin,"Ar-S Agony Intro",#PB_Window_BorderLess|#PB_Window_ScreenCentered)
OpenWindowedScreen(WindowID(#WIN),0,0,Lwin,Hwin,1,0,0)
SetFrameRate(18)
VIT = 15
CreateTextSprite()
DrawScore()
Start=ElapsedMilliseconds()
Repeat
Repeat
WindowEvent()
Until WindowEvent() = 0
; // 2D
ExamineKeyboard()
ShowScore()
If KeyboardReleased(#PB_Key_Right)
AnimSprite()
ClearScreen(0)
EndIf
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
FlipBuffers()
ForEver
End
EndProcedure
GOWINDOW()