| Function SetScale( scale_x#,scale_y# ) |
| Graphics 640,480 Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Local Player:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png")) Local x:float=1.0 Local y:float=1.0 Repeat Cls SetScale 1.0,1.0 DrawText "Scale X="+x+" Scale Y="+y,10,10 SetScale x,y DrawImage Player,MouseX(),MouseY() If KeyDown(KEY_X) x :+ .5 If x> 1.5 Then x=0.5 EndIf If KeyDown(KEY_Y) y :+ .5 If y> 1.5 Then y=0.5 EndIf Flushkeys Flip Until KeyHit(key_escape) Or AppTerminate() End |
![]() |
![]() |
| Graphics 640,480 Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Local Player:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png")) Local x:float=1.0 Local y:float=1.0 Repeat Cls SetScale 1.0,1.0 DrawText "Scale X="+x+" Scale Y="+y,10,10 SetScale x,y DrawImage Player,MouseX(),MouseY() If KeyDown(KEY_X) x =-x EndIf If KeyDown(KEY_Y) y =-y EndIf Flushkeys Flip Until KeyHit(key_escape) Or AppTerminate() End |
| Function GetScale( scale_x# Var,scale_y# Var ) |
| Function SetRotation( rotation# ) |
| Graphics 640,480 AutoMidHandle True Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Local Player:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png")) Local Rotation:float=0.0 Repeat Cls SetRotation 0.0 DrawText "Current Rotation is "+Rotation SetRotation Rotation DrawImage Player,MouseX(),MouseY() If KeyDown(KEY_X) Rotation :+ 30 If Rotation>360 Then Rotation=0.0 EndIf Flushkeys Flip Until KeyHit(key_escape) Or AppTerminate() End |
| Function SetTransform( rotation#=0,scale_x#=1,scale_y#=1 ) |
| Function DrawImageRect( image:TImage,x#,y#,w#,h#,frame=0 ) |
| Graphics 640,480 AutoMidHandle True Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Local Player:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png")) Local X:Int=32 Local y:Int=32 Repeat Cls DrawText "X="+x+" y="+y,10,10 DrawImageRect Player,MouseX(),MouseY(),x,y If KeyDown(KEY_X) x:+32 If x>128 Then x=32 EndIf If KeyDown(KEY_Y) y:+32 If y>128 Then y=32 EndIf FlushKeys Flip Until KeyHit(Key_Escape) Or AppTerminate() End |
| Function LoadImage:TImage( url:Object,flags=-1 ) |
| Flags value | Effect |
|---|---|
| FILTEREDIMAGE | The image is smoothed when scaled up to greater than its original size, when rotated, or when drawn at fractional pixel coordinates |
| MIPMAPPEDIMAGE | The image is smoothed when scaled down to less than its original size |
| Graphics 640,480 Local URL:String="http::www.2dgamecreators.com/tutorials/gameprogramming/basic/" Local Player:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png"),0) Local Player1:TImage=LoadImage(LoadBank(URL+"blobship_1-1.png"),FILTEREDIMAGE) Repeat Cls SetScale 3.0,3.0 DrawImage Player1,MouseX(),MouseY() DrawImage Player,MouseX()+200,MouseY() Flip Until KeyHit(key_escape) Or AppTerminate() End |
![]() |
| Local Alien:TImage=LoadImage("cartoonufo_1-1.png",FILTEREDIMAGE|MIPMAPPEDIMAGE) |