// All KPL programs start with the word "Program" followed by the
// name of your program, and end with the words "End Program", which
// you will see way down at the bottom of this KPL file.
Program UFO
Define strLoadSprite As String
Define boostop As Bool
Define intx As Int
Define inty As Int
// Method Main() is the starting point of all KPL programs, and is
// 'called' by KPL automatically when the program is run.
Method Main()
// Inställning
SetDeviceCoordinates()
//inställning
//ladda ufo
LoadSprite( "UFO", "UFO.gif" )
//ladda ufo
// Visa ufo
ShowSprite( "UFO" )
// visa ufo
boostop=False
While boostop=False
Delay(10)
If IsKeyDown("down") = True Then
inty=inty+1
MoveSpriteTo("ufo",intx, inty)
End If
If IsKeyDown("up") = True Then
inty=inty - 1
MoveSpriteTo("ufo",intx, inty)
End If
If IsKeyDown("right") = True Then
intx=intx + 1
MoveSpriteTo("ufo",intx, inty)
End If
If IsKeyDown("left") = True Then
intx=intx - 1
MoveSpriteTo("ufo",intx, inty)
End If
If IsKeyDown("r") = True Then
boostop=True
End If
eller den här:
// All KPL programs start with the word "Program" followed by the
// name of your program, and end with the words "End Program", which
// you will see way down at the bottom of this KPL file.
Program UFO
Define pos As Int
Define intX As Int
Define IntPuff As Int
Define strLoadSprite As String
// Method Main() is the starting point of all KPL programs, and is
// 'called' by KPL automatically when the program is run.
Method Main()
// Inställning
SetDeviceCoordinates()
//inställning
//ladda ufo
LoadSprite( "UFO", "UFO.gif" )
//ladda ufo
// Visa ufo
ShowSprite( "UFO" )
// visa ufo
Pen (Off)
For pos = 0 To 400 // step kan användas och därigenom öka med ett större tal varje varv.
IntPuff=IntPuff+1
If pos > 200 Then
If IntPuff>10 Then
IntPuff=0
MoveTo(pos- 3,100)
Pen (On)
Ellipse(10,5,True)
Pen (Off)
End If
Else
If IntPuff>20 Then
IntPuff=0
MoveTo(pos- 3,100)
Pen (On)
Ellipse(10,5,True)
Pen (Off)
End If
End If
//flytta ufo till punkt
Delay(1)
MoveSpriteToPoint("UFO",pos,100)
Next
//flytta ufo till punkt
UnloadSprite ("UFO")
LoadSprite ( "Explosion" , "Explosion.gif" )
MoveSpriteToPoint ( "explosion", pos, 100 )
ShowSprite ( "Explosion" )
For pos = 1 To 17
SetSpriteActiveFrame ("explosion", pos )
Delay ( 100 )
Next
HideSprite ( "explosion" )
End Method
End Program
01 oktober, 2008
Prenumerera på:
Kommentarer till inlägget (Atom)
Inga kommentarer:
Skicka en kommentar