cppman Posted February 18, 2006 Share Posted February 18, 2006 here is my script.... if you would be kind enough to look through it and tell me why it goes soooooo slow... thx. I attachted the images so you can see what i mean by slow... expandcollapse popup#include <GMFunctions.au3> ShowImage ("Logo", "logo.jpg") $MainWindow = GUICreate("My Game", 500, 500, -1, -1) GUISetBkColor(0x000000) $AmmoLabel = GUICtrlCreateLabel("Ammo Remaining: ", 5, 5) GUICtrlSetColor($AmmoLabel, 0xffffff) $AmmoData = GUICtrlCreateLabel("", 120, 5, 25, 25) GUICtrlSetColor($AmmoData, 0xffffff) GUISetState() $Sprite = SpriteCreate ("sprite.jpg", 25, 25, 25, 475) $x = 5 $y = 5 For $i = 1 To 100 Next Global $Bullet, $Boss_Bullet $Boss = SpriteCreate ("boss1.jpg", 100, 100, 250, 100) While 1 $BossPos = ControlGetPos("", "", $Boss) $Boss_AIMove = Random(1, 10, 1) If $Boss_AIMove = 1 Then BossMoveLeft() Else If $Boss_AIMove = 2 Then BossMoveRight() Else If $Boss_AIMove = 3 Then BossFire() Else EndIf EndIf EndIf $BulletPos = ControlGetPos("", "", $Bullet) If $BulletPos[0] = "2" Then GUICtrlDelete($Bullet) EndIf $ShipXY = ControlGetPos("", "", $Sprite) If _IsPressed ("28") Then $y = $y + 1 SpriteMove ($Sprite, $x, $y) Else If _IsPressed ("26") Then $y = $y - 1 SpriteMove ($Sprite, $x, $y) Else If _IsPressed ("25") Then $x = $x - 1 SpriteMove ($Sprite, $x, $y) Else If _IsPressed ("27") Then $x = $x + 1 SpriteMove ($Sprite, $x, $y) Else If _IsPressed ("20") Then Fire() EndIf EndIf EndIf EndIf EndIf WEnd Func Fire() If $Ammo <= 0 Then Return Else $Ammo = $Ammo - 1 GUICtrlSetData($AmmoData, $Ammo) $Bullet = SpriteCreate ("bullet.jpg", 10, 10, $ShipXY[0], $ShipXY[1]) For $i = $ShipXY[1] To 0 Step - 1 SpriteMove ($Bullet, $ShipXY[0], $i) Next EndIf EndFunc ;==>Fire Func BossFire() $Boss_Bullet = SpriteCreate ("boss_bullet.jpg", 70, 70, $BossPos[0], $BossPos[1]) For $i = $BossPos[1] To 500 SpriteMove ($Boss_Bullet, $BossPos[0], $i) Next EndFunc ;==>BossFire Func BossMoveLeft() For $i = 1 To 10 SpriteMove ($Boss, $BossPos[0], $i) Next EndFunc ;==>BossMoveLeft Func BossMoveRight() For $i = 1 To 10 SpriteMove ($Boss, $i, $BossPos[1]) Next EndFunc ;==>BossMoveRight Miva OS Project Link to comment Share on other sites More sharing options...
jpm Posted February 18, 2006 Share Posted February 18, 2006 difficult to help you without the include file and the .jpg names. The best would be to include all needed file in a .zip and post the .zip Link to comment Share on other sites More sharing options...
cppman Posted February 18, 2006 Author Share Posted February 18, 2006 sorry about that... Miva OS Project Link to comment Share on other sites More sharing options...
jpm Posted February 18, 2006 Share Posted February 18, 2006 sorry about that...Now we can try to understand.First what is slow? the animation seems pretty fast.Your problem can come from the fact the script is mono thread that's mean only one script line can be executed at a time.I am not sure which keyboard stroke should be used and what they are supposed to do.be more explicit on how to watch your slow problem Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now