Jump to content

Sprite Engine


LiveOnTheFly
 Share

Recommended Posts

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 :D

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.au3

pong.au3

Edited by LiveOnTheFly
Link to comment
Share on other sites

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

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. :D

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...