Jump to content

prospeed


jpam
 Share

Recommended Posts

New Update !

added Joystick functions

added FindJoystick()

added JoystickX()

added JoystickY()

added JoystickButton() ;up to 32 buttons

Collision deletesprite combination bug removed by Frank !

Redownload Prospeed.dll and Prospeed.au3 @ post 1

Have fun :)

Simple joystick demo ;

#include <GUIConstants.au3>
#include <Prospeed.au3>

Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode",2)
HotKeySet("{Esc}","_exit")

$GUI = GUICreate("Prospeed",800,400,-1,-1,$WS_POPUP)
GUISetState()

Background(@scriptdir & "\Hintergrund.jpg", 0, 0)

$Sprite1 = @scriptdir & "\Sprites.gif"
                    
$bee1 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 400, 200)
SetmovingRectangle($bee1,0, 0, 800-24, 400-18)
SetSpriteMovingMode($bee1, 1)
SetSpriteSpeed($bee1, 5, 5)
SetSpriteAnimMove($Bee1, 1, 0, 0)
SetSpriteAnimMove($Bee1, 2, 0, 0)
SetSpriteAnimMove($Bee1, 3, 0, 0)
SetSpriteAnimMove($Bee1, 5, 0, 32)
SetSpriteAnimMove($Bee1, 6, 0, 32)
SetSpriteAnimMove($Bee1, 7, 0, 32)

$bee2 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 150, 150)
$bee3 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 200, 200)
$bee4 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 250, 250)

$bee5 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 100, 300)
$bee6 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 150, 350)
$bee7 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 200, 400)
$bee8 = sprite($Sprite1, 0, 0, 24, 18, 4, 1, 6, 250, 100)

While 1

Sleep(10)

$butt = JoystickButton(1)
Select
    Case $butt = 1
        MsgBox(0,"Buttons","Button 1 pressed",1)
    Case $butt = 2  
        MsgBox(0,"Buttons","Button 2 pressed",1)
    Case $butt = 3  
        MsgBox(0,"Buttons","Button 3 pressed",1)
    Case $butt = 4
        MsgBox(0,"Buttons","Button 4 pressed",1)
EndSelect
    
GetSpriteInfos($bee1)
$gy = $current_Y
$gx = $current_X
$a = 0
$joyx = JoystickX(1)
$joyy = JoystickY(1)

If $joyx > 24 Then  
    MoveSprite($bee1, $gx+$joyx, $gy+$joyy)
    $a = 1
EndIf
If $joyx < -24 Then
    MoveSprite($bee1, $gx+$joyx, $gy+$joyy)
    $a = 1
EndIf
If $joyy > 24 Then
    MoveSprite($bee1, $gx+$joyx, $gy+$joyy)
    $a = 1
EndIf
If $joyy < -24 Then
    MoveSprite($bee1, $gx+$joyx, $gy+$joyy)
    $a = 1
EndIf
If $a = 0 Then
    MoveSprite($bee1, $gx, $gy)
EndIf   

$B2Hit = CollideUnknown()
If $B2Hit <> 0 then 
    deletesprite($B2Hit)
EndIf 
WEnd 

Func _exit()
Exit
EndFunc
Link to comment
Share on other sites

  • Replies 511
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

New Update !

added CountJoystickButtons()

added JoystickZ()

added JoystickR()

added JoystickU()

added JoystickV()

Changed Background() ;has now resizes function build in

added Water effect function ; if used wirh many sprites ,you need a fast computer ! :D

added Iniwater()

added Water()

Example water ;

Water_example.au3

image needed ;

http://home.wanadoo.nl/jpamvanderouderaa/back4.jpg

Enjoy :)

Edited by jpam
Link to comment
Share on other sites

When I run the water example it works but I get several warnings.

D:\Program\AutoIt3\Include\Prospeed.au3(299,91) : WARNING: $S_FXHANDLE1: possibly used before declaration.
    DllCall($S_DLL,"long","Fog","long",$hDC,"long",$S_POSX,"long",$S_POSY,"long",$S_FXHANDLE1,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\Program\AutoIt3\Include\Prospeed.au3(299,111) : WARNING: $S_FXHANDLE2: possibly used before declaration.
    DllCall($S_DLL,"long","Fog","long",$hDC,"long",$S_POSX,"long",$S_POSY,"long",$S_FXHANDLE1,"long",$S_FXHANDLE2,
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~^
D:\Program\AutoIt3\Include\Prospeed.au3(338,96) : WARNING: $S_InitExtFX1: possibly used before declaration.
        DllCall($S_DLL,"long","Rotate","long",$hDC,"long",$S_POSX,"long",$S_POSY,"long",$S_InitExtFX1,
        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\Program\AutoIt3\Include\Prospeed.au3(386,94) : WARNING: $S_InitExtFX: possibly used before declaration.
    DllCall($S_DLL,"long","Rustle","long",$hDC,"long",$S_POSX,"long",$S_POSY,"long",$S_InitExtFX)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
D:\Program\AutoIt3\Include\Prospeed.au3(280,39) : WARNING: $S_FXHANDLE1: declared global in function only. Prefer top of file.
    Global $S_FXHANDLE1 = $S_FXHANDLE1[0]
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
Link to comment
Share on other sites

Hallman,

I presume by your request that you're interested in making a tile-based game with scrolling capability. There is nothing in Prospeed that will give your game this ability directly. You'll have to manually shuffle/scroll the sprites around for each move. Since sprite position updating takes such a long time to perform per move in AutoIt, it's not the most appealing language to write a scrolling tile-based game in. The larger your grid is, the slower the shuffle gets. Users will be able to see the shuffling happen in a grid larger than about 8x8 tiles using Prospeed. Even if you don't mind the slowdown, it's not a clean look.

In that scenario, to preserve the clean look, it might be better to use a swapping trick, similar to double-buffered screen swapping, but I haven't done it myself yet. Essentially this would be a screenshot situation with the following flow:

1. Screenshot the grid at current position (which, using Prospeed, is very fast).

2. When user moves, throw up the screenshot immediately.

3. Perform the tile shuffle (scroll) behind the screenshot.

4. When the shuffle is finished, remove the screenshot to reveal the shuffled grid.

5. Go back to step 1.

Of course, the tile shuffle speed would increase as the grid size increases, so one would have to balance time per move vs. grid size in order to find an acceptable rate.

So far I have compromised by moving the character instead of the whole grid. When the character moves off the screen, I swap in a whole new grid (with screenshot during shuffle) and move the character to the opposite side. Using this method, it is still possible to create large maps with grid-sized windows into the playing field.

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

Fantastic! :)

-S

(Yet Another) ExcelCOM UDF"A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly...[indent]...specialization is for insects." - R. A. Heinlein[/indent]
Link to comment
Share on other sites

Nice to see you fix it so fast.

Two questions. What are the two last parameters (both set to constant 1) in the InitSprite dllcall in the Sprite() function used for?

(a bit edited for easier reading)

$Sprite_ID = DllCall($S_DLL,"long","InitSprite","long",$S_Spriteplane[0],"long",$hDC,"long",$S_fensterkopie1[0], _
                            "long",$S_fensterkopie2[0],"long",$S_offsetX,"long",$S_offsetY,"long",$S_WIDTH, _
                            "long",$S_HEIGHT,"long",$S_FRAMES,"long",$S_START_FRAME,"long",$S_FRAME_SPEED, _
                            "long",$S_posX,"long",$S_posY,"long",1,"long",1)

Also, did the pixel Sprite() use to determine transparency change from top-left to top-right?

(The green thing is a single 128x128 sprite)

Posted Image

Edited by Lej
Link to comment
Share on other sites

The last 2 parameters are speedsettings X and Y

i don't use them because you can set it by function SetSpriteSpeed ()

the second question ,i don't understand what you want with transparency change

transparency doesen't change as far as i no

Link to comment
Share on other sites

Been fooling around some with prospeed today and ran into a problem.

So far all apps I've seen has been made in windows with $WS_POPUP.

This means no border and as prospeed.au3 always chooses the active window

(usually looks like this:)

$WIN_TILLE = WinGetTitle("","")
$WIN_GETHANDLE = WinGetHandle($WIN_TILLE,"")
$RAW_HDC = DllCall("user32.dll","ptr","GetWindowDC","hwnd",$WIN_GETHANDLE)
Global $hDC     = "0x" & Hex($RAW_HDC[0])oÝ÷ Ù8b²g̨º»§{h²¶º.nW°éò¢ëkÊÚ.±æ§¢¹§v¢¼¨º¶©¥«"·¥ÚÚÁúèØ^½êò¶¢¹Þ®) Ûiÿø¦n9f zÈZrK¬þ) ÛßÏ5ýÚÚÂ)à¢÷«nÝzºóâàþ) "ÚâyÛh²ozØb±¼¬zÛb Úß±ëZÛazwX§ëÞ¯+ax0Øm«H·ljZ-¡ü(®F§uÚ²z-Âä×M(^)(çîËb¢{j}ýµ·jY^w­¬r¦j׫~ÞÅ©©è¦m§ÿâwf zÈZrK¬þ) çöÓ^ÿÁ«^¯­ß±ë[·ªgø¦kçm¢Ê%½è­o))àjz-êðwhí­nÝz»¶Ø^®(!¶Zqæ§w­Ø^®(!¶È³y8b²ÇÉbëay·¬¶Ê%ºØ¨ú+êÞßÛ(æâènW¦¶.èëmæè­×«ë,Â)Ý£h²Ö²zeiÇ¢*.v¶ ¶¢·^­çpwhÃ*.ß×pj{m¢f¤z+Zr¥tz0z÷«ü¨¹Ú,¡h§ëSÙ^ªê-ªê-ªê-ªê-Â)e­ën®{az«z{pwhÃl¶+ey©ÝÝýYh¢Ibëayø«²ÚbrÛ«x.¬·*.©²Á¬¢»azë®Ú,zÜ!Èpwh°j{l¶kk
'"×(ºW[y¨%¡¶¥²Ú+xÂ)Ý£ZÙ^²azë­Ê.Ûµ©òÂ)Ý£!Whë-¢hmë¬y×è­ÚÚÂ)à
çÚº[¢é]mꮢڮ¢Ö¬¶­ßÛ-çÚ[«z·­º¹ß¢µ¢g­©Ýäáz|¨»]ë-«Þ¶!jx¶nÞr^¶(ëax%GºÚ"µÍÌÍÕÒSÑÑUSHHÚ[Ù][J  ÌÍÓUÔÕQÑÑTÕQÓÐS
BÌÍÔU×ÒÈHØ[
    ][ÝÝÙÌ  ][ÝË  ][ÝÜ][ÝË    ][ÝÑÙ]Ú[ÝÑÉ][ÝË    ][ÝÚÛ    ][ÝË  ÌÍÕÒSÑÑUSJBÛØ[  ÌÍÚÈH   ][ÝÌ  ][ÝÈ  [È^
    ÌÍÔU×ÒÖÌJ

If the global is "" WinGetHandle() returns the current active window if it's a windowhandle it returns the same windowhandle.

Another way would be to add a window handle parameter to all function. That would mean a lot of work both for you and programmers and might not be an ideal solution.

Edited by Lej
Link to comment
Share on other sites

New Update !

All issues with window styles solved

please redownload the prospeed.au3 @ post 1

Did a lot of testing

If there are functions that do not function properly

Please report here , so i can fix it

jpam :)

Edited by jpam
Link to comment
Share on other sites

Working on Fmod support

playing ; .MOD, .S3M, .XM, .IT .MID .WAV, .MP2, .MP3, .OGG or .RAW

what do you guys want ?

inside prospeed.udf or new UDF ?

let me know :)

Kind Recards

jpam

Excellent!!! :whistle:

Seperate UDF I think, not too difficult to add an extra include in my script :lol:, and people may want to use just this for the Midi stuff.

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

Link to comment
Share on other sites

  • 2 weeks later...

Hi Jpam

None of your examples are working with AutoIt 3.2.2.0 :whistle:

You should say on the main post which script is working with which AutoIt version.

You've done a fantastic work, so bad we have to debug the examples to play with them :)

SetBackAutoCollision.au3 is bugfull too : some vars ($S_A, $S_:lol: are used but defined nowhere.

I hope to see a fully 3.2.2.0 compatible prospeed.au3+dll+examples soon :)

Regards

Apzo.

Link to comment
Share on other sites

i will update all the examples ASAP

last few weeks i had no time to work on prospeed :">

some other things where eating my time (wife,kids,house)

The udf has made a lot of changes and some of them make the examples not working anymore

so, in the next few days i will post new examples

Kind Regards

jpam

:whistle:

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