LiveOnTheFly Posted April 10, 2009 Share Posted April 10, 2009 (edited) This UDF will allow you to put sprites in your GUI easily. Requirements: No AdlibDisable() Documentation _SpriteInit($hGuiHandle, $iNumberOfSprites = 100, $iFps = 60) - You must call this to initialize the sprite engine. If you set $iNumberOfSprites too low some sprites may not get created. _SpriteRunning($iRunning) - if you set this to 0 the sprite engine will pause itself. If you set it to 1 guess what happens _SpriteCreate($sPicFilePath, $iX, $iY, $iWidth = "", $iHeight = "", $vStyle = "", $vExStyle = "") - Creates a sprite. Returns the sprites handle or 0 is there are no handles avaliable _SpriteDelete($hHandle) - Just guess what this does. _SpriteSetMovement($hHandle, $iSpeed, $iAngle) - sets the sprites movement. the speed is the number of pixels it moves per frame. The angle is the direction in which it moves _SpriteSetCoords($hHandle, $iX, $iY) - sets a sprite's coordinates _SpriteCheckCollision($hHandle1, $hHandle2) - returns 1 if the two sprites are touching each other _SpriteGetCoords($hHandle) - returns a two element array. [0] - x position [1] - y _SpriteGetSize($hHandle) - returns a two element array. [0] - width [1] - height _SpriteFollowMouse($hHandle,$iFollowMouse) (UNCOMPLETED) if you set this to 1 the sprite will follow the mouse on the x axis _SpriteGetMovement($hHandle) - returns a two element array [0] - speed [1] - angle Hope you enjoy it! I'm working on a breakout example for this Edit: for the pong example you need to create 3 files. Red.bmp Blue.bmp and Green.bmp they cna be of any dimensions. put the color into the file. They are too big to upload to the forums and i'm too lazy to sendspace it._SpriteEngine.au3pong.au3 Edited April 10, 2009 by LiveOnTheFly Link to comment Share on other sites More sharing options...
martin Posted April 10, 2009 Share Posted April 10, 2009 I get C:\Temp\_SpriteEngine.au3 (137) : ==> Subscript used with non-Array variable.: $Return[0] = $pos[2] $Return[0] = $pos^ ERROR Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
LiveOnTheFly Posted April 10, 2009 Author Share Posted April 10, 2009 (edited) I getThat means the sprite wasn't created properly. Silly me forgot to upload the red green and blue.bmp for the pongEdit: it's too big to upload so just create the bmps your self Edited April 10, 2009 by LiveOnTheFly Link to comment Share on other sites More sharing options...
BrettF Posted April 10, 2009 Share Posted April 10, 2009 can you use other formats like JPG or does it have to be bmp for this. The example is okay... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
JRowe Posted April 10, 2009 Share Posted April 10, 2009 A suggestion, for what it's worth, would be to use A.Percy's au3Irrlicht script and billboards. You immediately gain the advantages of having 3D rendering and special effects (lighting) and using any image format, as well as neat transparency and multiple rendering engine options, with all the performance benefits that come with it. It's really easy to use, and a sprite engine built on top of irrlicht would rock. [center]However, like ninjas, cyber warriors operate in silence.AutoIt Chat Engine (+Chatbot) , Link Grammar for AutoIt , Simple Speech RecognitionArtificial Neural Networks UDF , Bayesian Networks UDF , Pattern Matching UDFTransparent PNG GUI Elements , Au3Irrlicht 2Advanced Mouse Events MonitorGrammar Database GeneratorTransitions & Tweening UDFPoker Hand Evaluator[/center] Link to comment Share on other sites More sharing options...
LiveOnTheFly Posted April 11, 2009 Author Share Posted April 11, 2009 can you use other formats like JPG or does it have to be bmp for this. The example is okay...Anything that GuiCtrlCreatePic can handle. 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