jpam Posted January 8, 2007 Author Share Posted January 8, 2007 i'll put GetSpriteInfos() in today when am back from work @ hallman ; for sprites you allready have a handle it's the sprite nr every sprite you add counts +1 and i am working for a redresh function to have to "bitblit" it i think Link to comment Share on other sites More sharing options...
Lakes Posted January 8, 2007 Share Posted January 8, 2007 Here`s the code using the example gif, it displays a black box for the 11th sprite. expandcollapse popup#include <GUIConstants.au3> #include <Prospeed.au3> Opt("GUIOnEventMode", 1) HotKeySet("{Esc}","_exit") $gui = GUICreate("Prospeed",800, 400, -1, -1,$WS_POPUP) GUISetState() ;Background(FILE, POSX, POSY) ;loads Background Background(@scriptdir & "\Hintergrund.jpg", 0, 0) $SprOfX = 0 $SprOfY = 0 $SpWid = 24 $SpHgt = 24 $SpFrms = 4 $SpStFrm = 1 $SpFrmSpd = 6 $SpPosX = -30 ;Sprite("Sprite picture", offsetX, offsetY, WIDTH, HEIGHT, FRAMES, START_FRAME, FRAME_SPEED, posX, posY) ;loads sprites sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 50) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 80) sprite(@scriptdir & "\Sprites2.gif", 0, 0, 24, 18, 4, 1, 6, -30, 130) sprite(@scriptdir & "\Sprites2.gif", 0, 0, 24, 18, 4, 1, 6, -30, 160) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 50) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 50) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 80) sprite(@scriptdir & "\Sprites2.gif", 0, 0, 24, 18, 4, 1, 6, -30, 130) sprite(@scriptdir & "\Sprites2.gif", 0, 0, 24, 18, 4, 1, 6, -30, 160) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 50) sprite(@scriptdir & "\Sprites.gif", 0, 0, 24, 18, 4, 1, 6, -30, 50) ; <----------- Black box Displayed -------------------- $SprSpdX = 3 $SprSpdY = 4 For $i = 1 to 11 SetSpriteSpeed($i, $SprSpdX, $SprSpdY) next ;SetmovingRectangle(Sprite nr, LEFT, TOP, RIGHT, BOTTOM) sets cage for sprite For $i = 1 to 11 SetmovingRectangle($i, 0, 0, 780, 380) next ;Movesprite(Sprite nr, posx, posy, Speed_x, Speed_y) ;Sets sprites movement Movesprite(3, 810, 0, 5, 1) Movesprite(4, 810, 410, 6, 3) While 1 For $i = 1 to 11 Movesprite($i,Random(5, 780, 1),Random(5, 410, 1), 6, 3) next Sleep(250) WEnd Func _exit() Exit EndFunc 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Lakes Posted January 8, 2007 Share Posted January 8, 2007 Collide example which sort of works, but it seems to take a long time to clear itself... expandcollapse popup#include <GUIConstants.au3> #include <Prospeed.au3> Opt("MouseCoordMode",0) Opt("GUIOnEventMode", 1) HotKeySet("{Esc}","_exit") $GUI = GUICreate("Prospeed",800,400,-1,-1,$WS_POPUP) GUISetState() ;Background(FILE, POSX, POSY) ;loads Background Background("D:\Hintergrund.jpg", 0, 0) $SprOfX = 0 $SprOfY = 0 $SpWid = 24 $SpHgt = 18 $SpFrms = 4 $SpStFrm = 1 $SpFrmSpd = 6 $SpPosX = -30 $Sprite1 = @scriptdir & "\Sprites.gif" $Sprite2 = @scriptdir & "\Sprites2.gif" ;Sprite("Sprite picture", WIDTH, HEIGHT, FRAMES, START_FRAME, FRAME_SPEED, posX, posY) ;loads sprites sprite($Sprite1, $SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX, 50) sprite($Sprite2, $SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX, 130) ;SetmovingRectangle(Sprite nr, LEFT, TOP, RIGHT, BOTTOM) sets cage for sprite SetmovingRectangle(1, 0, 0, 780, 380) SetmovingRectangle(2, 0, 0, 780, 380) ;Movesprite(Sprite nr, posx, posy, Speed_x, Speed_y) ;Sets sprites movement $SprSpdX = 3 $SprSpdY = 4 SetSpriteSpeed(1, $SprSpdX, $SprSpdY) SetSpriteSpeed(2, $SprSpdX -2, $SprSpdY - 2) Movesprite(1,810,0,5,1) Movesprite(2,810,410,6,3) While 1 $pos = MouseGetPos() Movesprite(1,$pos[0]-20,$pos[1]-40,6,3) Collide(1, 2) If $Collide[0] = 1 then Beep(100,100) sleep(100) EndIf WEnd Func _exit() Exit EndFunc Should there be an _ArrayPush in the pixel accurate Collision? Thanks as always. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Nordwind Posted January 8, 2007 Share Posted January 8, 2007 @ hallman ; for sprites you allready have a handle it's the sprite nrevery sprite you add counts +1Not in original. ProSpeed gives back a real handle by InitSprite(). It's a pointer to a 1024 bytes big memory, that includes all sprite parameters. I recommend urgently to use the original handles insteed of own numbers! Link to comment Share on other sites More sharing options...
Nordwind Posted January 8, 2007 Share Posted January 8, 2007 Should there be an _ArrayPush in the pixel accurate Collision?Collide() don't work pixel accurate. If you need a pixel accurat collision, you have to use Collision()... Collide bases on rectangles. Link to comment Share on other sites More sharing options...
jpam Posted January 8, 2007 Author Share Posted January 8, 2007 I checked the udf i allready use the original handle that the dllcall gives me every time a sprite is made it put's the pointer of the handle in an array mybe its better to put a name in it to but how kan i change the the stringname every time a sprite is made in the udf ? some autoit guru can point me to the right direction ? so the $Sprite_ID has to change every time $Sprite_ID = DllCall($S_DLL,"long","InitSprite..................... mybe i am to tired from work to think straight Link to comment Share on other sites More sharing options...
Lakes Posted January 8, 2007 Share Posted January 8, 2007 I`d like to reuse a Sprites(s) for my scoring system, more efficent than creating sprites for all the numbers. (It would be cool to have a 100 sprites on screen anyway... ) Like the SetSpriteAnimMove function, but where it takes a variable instead of the sprite move to reference the Image offsets. Thanks! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
Lakes Posted January 9, 2007 Share Posted January 9, 2007 This shows the problem when you have more than 10 sprites. The 11 sprite is only drawn, because I have loaded a new backbround, the 12th sprite is not drawn.expandcollapse popup#include <GUIConstants.au3> #include <Prospeed.au3> Opt("MouseCoordMode",0) Opt("GUIOnEventMode", 1) HotKeySet("{Esc}","_exit") $gui = GUICreate("Prospeed",800, 400, -1, -1,$WS_POPUP) GUISetState() ;Background(FILE, POSX, POSY) ;loads Background Background(@scriptdir & "\Hintergrund.jpg", 0, 0) $SprOfX = 0 $SprOfY = 0 $SpWid = 24 $SpHgt = 18 $SpFrms = 4 $SpStFrm = 1 $SpFrmSpd = 6 $SpPosX = 480 ;Sprite("Sprite picture", offsetX, offsetY, WIDTH, HEIGHT, FRAMES, START_FRAME, FRAME_SPEED, posX, posY) ;loads sprites sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,20) sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,40) sprite(@scriptdir & "\Sprites2.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,60) sprite(@scriptdir & "\Sprites2.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,80) sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,100) sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,120) sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,140) sprite(@scriptdir & "\Sprites2.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,160) sprite(@scriptdir & "\Sprites2.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,180) sprite(@scriptdir & "\Sprites.gif",$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,200) Background(@scriptdir & "\dino.jpg", 0, 0) sprite(@scriptdir & "\Sprites2.gif", 0, 0, 24, 18, 1, 1, 1, 50, 50) ; <--------- Draws over new background sprite(@scriptdir & "\Sprites.gif", 0, 0, 34, 50, 1, 1, 1, 50, 160) ; <--------- Not Drawn $SprSpdX = 3 $SprSpdY = 4 $NumOfSpr = 10 For $i = 1 to $NumOfSpr SetSpriteSpeed($i, $SprSpdX, $SprSpdY) next SetSpriteSpeed(11, $SprSpdX, $SprSpdY) SetSpriteSpeed(12, $SprSpdX, $SprSpdY) ;SetmovingRectangle(Sprite nr, LEFT, TOP, RIGHT, BOTTOM) sets cage for sprite For $i = 1 to $NumOfSpr SetmovingRectangle($i, 500, 0, 790, 390) next SetmovingRectangle(11, 0,0, 440, 380) SetmovingRectangle(11, 0,0, 440, 380) While 1 $pos = MouseGetPos() Movesprite(11,$pos[0],$pos[1], 1, 1) WEnd Func _exit() Exit EndFunc 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
jpam Posted January 9, 2007 Author Share Posted January 9, 2007 @lake your dino.jpg should be the same size as Hintergrund.jpg before you change background delete first all sprite's with Func "DeleteAllSprites()" and renew the sprites. that's it kind Regards jpam Link to comment Share on other sites More sharing options...
Lakes Posted January 9, 2007 Share Posted January 9, 2007 The Dino.jpg was loaded just to show sprite 11 being drawn, if you don`t load a different background then sprite 11 & 12 don`t get drawn at all, jst a black box appears. Did you forget to update the Prospeed.udf? the new/updated functions are`nt there... Thanks for your continued efforts. 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
jpam Posted January 9, 2007 Author Share Posted January 9, 2007 strange ! don't change background !!! hehe sorry just kidding i look in to it Link to comment Share on other sites More sharing options...
Lakes Posted January 9, 2007 Share Posted January 9, 2007 Thanks very much, don`t forget to load the new UDF while your here! 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
jpam Posted January 9, 2007 Author Share Posted January 9, 2007 found problem in prospeed.au3 it doesen't free memory space for background i have to contact nordwind about it prospeed.au3 updated Link to comment Share on other sites More sharing options...
jpam Posted January 9, 2007 Author Share Posted January 9, 2007 problem solved prospeed.au3 updated put a sleep before you delete all sprites otherwise you won't see the change Link to comment Share on other sites More sharing options...
Lakes Posted January 9, 2007 Share Posted January 9, 2007 (edited) Erm, the more than 10 sprites problem?, still not working here... Just the standard background now... Unless you mean something else... Edited January 9, 2007 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
jpam Posted January 9, 2007 Author Share Posted January 9, 2007 (edited) i tryed your script you post here and it works here mybe you have to redownload the prospeed.au3 i updated twice edit; your right 10 sprites is ok, if you put 1 more it turns black i am going to look further Edited January 9, 2007 by jpam Link to comment Share on other sites More sharing options...
Lakes Posted January 9, 2007 Share Posted January 9, 2007 (edited) Many Thanks Collision works good now. Edited January 9, 2007 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
jpam Posted January 10, 2007 Author Share Posted January 10, 2007 you better use "CopySprite($S_nr)" no black sprites anymore udf updated Link to comment Share on other sites More sharing options...
jpam Posted January 10, 2007 Author Share Posted January 10, 2007 @Hallman func "LoadImage" does what you want now, but not for all effects you can first load a image put it on screen or hold it in memory swich = 0/1 then put 1 or more effects on it hope that helps you Link to comment Share on other sites More sharing options...
Zedna Posted January 10, 2007 Share Posted January 10, 2007 Hey guys just must say WOW too!!! :D Amazing oportunities with this stuff ... Resources UDF ResourcesEx UDF AutoIt Forum Search 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