I get an simple game programmed, called to add an element (an map) for create an text with the drawing 2d functions.
Just i try to write an script to add an map ellement [NewMap Text.s(), ...]. I try to do an test to choote bullet, called
to do an simple test with draw test you must press the 'space' key pushed to create them, just if the text is > 480 pixels
under the screen (YPos + 1), than the text must be deleted [DeleteElement(Text(), "B")] and if you press 'space' again,
my means is to create the element map again yet...
So this is my code, writted in pure basic 5.x yet:
Code: Select all
Global XPos.i = 320
Global YPos.i = 0
NewMap Text.s()
Text("1") = "B"
If InitSprite() = 0 Or InitKeyboard() = 0 Or OpenScreen(640, 480, 32, "Add Element Text Test") = 0
MessageRequester("Fatal Error", "Failed to initialize", #PB_MessageRequester_Error)
End
EndIf
Repeat
If Speed & 1
YPos + 1
EndIf
StartDrawing(ScreenOutput())
Repeat
DrawText(XPos, YPos, Text("1"), RGB(255, 255, 255), DrawingMode(#PB_2DDrawing_Transparent))
Speed + 1
ForEver
StopDrawing()
FlipBuffers()
ClearScreen(0)
If YPos > 480
DeleteMapElement(Text(), "B")
EndIf
ExamineKeyboard()
If KeyboardPushed(#PB_Key_Space)
AddMapElement(Text(), "B")
EndIf
If KeyboardPushed(#PB_Key_Escape)
End
EndIf
ForEver
So it doesn't works. Just can anyone correct my code, just i can expiriment with the NewMap ...
Function ?..., thanks for help, Jamie.