Jump to content

prospeed


jpam
 Share

Recommended Posts

  • Replies 511
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Its a Swarm!! Don`t get stung! :)

CODE
#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)

$POSX = 0

$POSY = 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", offsetX, offsetY, WIDTH, HEIGHT, FRAMES, START_FRAME, FRAME_SPEED, posX, posY) ;loads sprites

sprite($Sprite1,$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,40)

sprite($Sprite2,$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,60)

#CS

CopySprite

syntax : CopySprite(nr)

Note ; copies a sprite with indentical parameters

If you want to make a lot of incentical sprites you better use CopieSprite

Create first sprite with Sprite func and then copie that sprite multiple times

#CE

$NumOfSpr = 80

For $i = 1 to $NumOfSpr

CopySprite(1)

CopySprite(2)

next

$SprSpdX = 3

$SprSpdY = 4

For $i = 1 to $NumOfSpr

SetSpriteSpeed($i, $SprSpdX, $SprSpdY)

next

#CS

SetSpriteAnimMove

syntax : SetSpriteAnimMove(Spritename, Sprite nr, Direction, offsetX, offsetY)

Note ; Spritename = name created with func Sprite()

Sprite nr = number of the sprite created by function Sprite()

Direction = The direction to face the sprite to

For every direction the sprite moves you can change the animation sequence

0 = Standing still

1 = right up

2 = right

3 = right down

4 = down

5 = left down

6 = left

7 = left up

8 = up

offsetX = Where to find the sprite in the bitmap on x position ;Mostly starts with zero

offsetY = Where to find the sprite in the bitmap on y position

#ce

SetSpriteAnimMove($Sprite1, $NumOfSpr, 1, 0, 0)

SetSpriteAnimMove($Sprite1, $NumOfSpr, 2, 0, 0)

SetSpriteAnimMove($Sprite1, $NumOfSpr, 3, 0, 0)

SetSpriteAnimMove($Sprite1, $NumOfSpr, 5, 0, 32)

SetSpriteAnimMove($Sprite1, $NumOfSpr, 6, 0, 32)

SetSpriteAnimMove($Sprite1, $NumOfSpr, 7, 0, 32)

For $i = 1 to $NumOfSpr/2

SetSpriteAnimMove($Sprite1, $i, 1, 0, 0)

SetSpriteAnimMove($Sprite1, $i, 2, 0, 0)

SetSpriteAnimMove($Sprite1, $i, 3, 0, 0)

SetSpriteAnimMove($Sprite1, $i, 5, 0, 32)

SetSpriteAnimMove($Sprite1, $i, 6, 0, 32)

SetSpriteAnimMove($Sprite1, $i, 7, 0, 32)

Next

For $i = $NumOfSpr/2 to $NumOfSpr

SetSpriteAnimMove($Sprite2, $i, 1, 0, 0)

SetSpriteAnimMove($Sprite2, $i, 2, 0, 0)

SetSpriteAnimMove($Sprite2, $i, 3, 0, 0)

SetSpriteAnimMove($Sprite2, $i, 5, 0, 32)

SetSpriteAnimMove($Sprite2, $i, 6, 0, 32)

SetSpriteAnimMove($Sprite2, $i, 7, 0, 32)

Next

;SetmovingRectangle(Sprite nr, LEFT, TOP, RIGHT, BOTTOM) sets cage for sprite

For $i = 1 to $NumOfSpr

SetmovingRectangle($i, 0, 0, 790, 390)

next

For $n = 1 to 19

For $i = 1 to $NumOfSpr - 1

Movesprite($i,Random(5,800, 1),Random(5,410, 1), 4, 1)

sleep(10)

Next

next

While 1

For $i = 1 to $NumOfSpr - 1

$pos = MouseGetPos()

Movesprite($NumOfSpr,$pos[0],$pos[1], 1, 1)

Movesprite($i,800 ,400, 2, 1)

sleep(150)

Next

WEnd

Func _exit()

Exit

EndFunc

EDIT: has correct sprite Anim now.

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

@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

Thanks jpam. Works like a charm for what I want. This project is moving quite fast. Before to long you will have all prospeed functions as UDF's. The joystick stuff might prove usefull. Thanks for this great addition to AutoIt.

Edited by Hallman
Link to comment
Share on other sites

Hello!

It doesnt work by me. ive testet you sprite example but he crash ever with the Subscript crash

D:\skripts\Autoit\wg01.au3 (512) : ==> Subscript used with non-Array variable.:

DllCall($S_DLL,"long","CopyExtBmp","long",$S_fensterkopie1[0],"long",0,"long",0,"long",$S_WINSIZE[0],"long",$S_WINSIZE[1],"long",$hDC,"long",0,"long",0,"long",0)

DllCall($S_DLL,"long","CopyExtBmp","long",$S_fensterkopie1^ ERROR

Btw: Why open you every funktion the Dll prospeed and close it then in the funct? Why not on Start of the UDF (e.g. Line 32: Dim $S_DLL = DllOpen("ProSpeed.dll") ) and then with OnAutoItExit() ( DllClose($S_DLL)) I think so its just a little bit faster...

But what ive seen so far from your udf is very very great! Thanks to you jpam and Frank!

Mfg/best regards Spider :)

www.AutoIt.de - Moderator of the German AutoIt Forum

 

Link to comment
Share on other sites

There's a new updated for you guys

added GetSpriteMoveX

added GetSpriteMoveY

added InitPixelEffects

added SetPixelEffect

added DeInitPixelEffects

Have fun

For Joystick functions there's comming a new special prospeed.dll version

frank change some things in the dll to work with Joysticks and AutoIt

Link to comment
Share on other sites

Corrected missing $S_StartPixel var in

Func SetPixelEffect($S_offsetX, $S_offsetY, $S_Color, $S_StartPixel, $S_Disperse, $S_PixelStrenght, $S_Pixeldirection, $S_PixelAmount, $S_Colormode, $S_LifeTime)
    DllCall($S_DLL,"long","SetPixelEffect","long",$hDC,"long",$S_fensterkopie1[0],"long",$S_offsetX,"long",$S_offsetY,"long",$S_Color,"long",$S_StartPixel,"long",$S_PixelStrenght,"long",$S_Pixeldirection,"long",$S_Pixelamount,"long",$S_Colormode,"long",$S_LifeTime)
EndFunc

2015 - Still no flying cars, instead blankets with sleeves.

Link to comment
Share on other sites

New Update

Added BackgroundScroll

Added Scroll_Left()

Added Scroll_Right()

Added Scroll_Up()

Added Scroll_Down()

Added Scroll_Stop()

Download Example code + pictures from first page

All Collision functions working properly now

Movesprite function changed to

"Movesprite(Sprite number, posX, posY)"

Speed settings are set with function "SetSpriteSpeed(Sprite number, SpeedX, SpeedY)"

Don't forget to update your "Prospeed.au3" from first page

Have fun

jpam

Edited by jpam
Link to comment
Share on other sites

Working Ok here, but I have the original Dll here...

I mean the one after the original version where the autoit bug was fixed, I think Frank may have changed the Dll to work for Autoit Joystick functions?

Edited by Lakes

2015 - Still no flying cars, instead blankets with sleeves.

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