Jump to content

prospeed


jpam
 Share

Recommended Posts

Ok, here the bees-demo including a refresh of the background via WM_PAINT.

#include <GUIConstants.au3>
#include <Prospeed.au3>
#include <Math.au3>
Opt("MouseCoordMode",0)
;Opt("GUIOnEventMode", 1)
HotKeySet("{Esc}","_exit")

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

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"
$SprSpdX = 4
$SprSpdY = 4

$Bee1 = sprite($Sprite1,$SprOfX, $SprOfY, $SpWid, $SpHgt, $SpFrms, $SpStFrm, $SpFrmSpd, $SpPosX,40)
DllCall($S_DLL,"long","SetSpriteMovingMode","long",$Bee1,"long",1)

$NumOfSpr = 160
$EndDim = $NumOfSpr -1

Dim $CopyBee1[$NumOfSpr]

For $i = 1 to $EndDim
  $CopyBee1[$i] = CopySprite($Bee1)

  DllCall($S_DLL,"long","SetSpriteMovingMode","long",$CopyBee1[$i],"long",1)

  SetSpriteSpeed($CopyBee1[$i], $SprSpdX, $SprSpdY)

  SetSpriteAnimMove($CopyBee1[$i], 1, 0, 0)
  SetSpriteAnimMove($CopyBee1[$i], 2, 0, 0)
  SetSpriteAnimMove($CopyBee1[$i], 3, 0, 0)
  SetSpriteAnimMove($CopyBee1[$i], 5, 0, 32)
  SetSpriteAnimMove($CopyBee1[$i], 6, 0, 32)
  SetSpriteAnimMove($CopyBee1[$i], 7, 0, 32)
next


Global Const $WM_PAINT = 0x000F
GUIRegisterMsg($WM_PAINT, "PaintNew")
GUISetState()
Func PaintNew()
  DllCall($S_DLL,"long","CopyExtBmp","long",$hDC,"long",0,"long",0,"long",$S_WIDTH[0],"long",$S_HEIGHT[0],"long",$S_fensterkopie1[0],"long",0,"long",0,"long",0)
EndFunc


$Size = 20; vars for circle
$OrgX = 400;
$OrgY = 200;
$Stp = 10;
$n = 0
While 1
    For $i = 1 to $EndDim - 1
      $pos = MouseGetPos()
      $R  = _Radian ($n)
      $X  = Sin($R)*$Size * 3 + $OrgX
      $Y  = Cos($R)*$Size * 1.5 + $OrgY
      moveSprite($CopyBee1[$i], $X, $Y)
      $n = $n + 10
      if $n > 360 then
        $n = 0
        $Size = $Size + 10
        If $Size > 200 then $Size = 20
      Endif
      Sleep(10)

    Next
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

Udf Updated !

added MouseOverSprite

added SetSpriteMovingMode

added Image effect "Smooth" (Like blur but with mask picture)

Screenshot bug removed (Wrong HDC)

Wm_paint in udf ,thanks to Frank

Better demo of backgroundscroll

download @ post 1

Link to comment
Share on other sites

Spelling bee? :)

Getting bees to spell is hard, there`s always the odd one or two that act up... :D

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

$dll = DllOpen("user32.dll")
Opt("GUIOnEventMode", 1)
Opt("MouseCoordMode",2)
HotKeySet("{Esc}","_exit")

$NumOfSpr = 91
$Spd      = 5
$RectW    = 780
$RectH    = 390
$EndDim   = $NumOfSpr - 1
$SprWd    = 24
$SprHgt   = 18
Dim $Copybee  [$NumOfSpr]
Dim $CopybeeX [$NumOfSpr]
Dim $CopybeeY [$NumOfSpr]
$Delay    = 5000

$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, $SprWd, $SprHgt, 4, 1, 6, -30, 15)

For $i = 1 to $EndDim
    $CopyBee[$i] = copysprite($bee1)
next

For $i = 1 to $EndDim
    SetSpriteAnimMove($Copybee[$i], 1, 0, 0)
    SetSpriteAnimMove($Copybee[$i], 2, 0, 0)
    SetSpriteAnimMove($Copybee[$i], 3, 0, 0)
    SetSpriteAnimMove($Copybee[$i], 5, 0, 32)
    SetSpriteAnimMove($Copybee[$i], 6, 0, 32)
    SetSpriteAnimMove($Copybee[$i], 7, 0, 32)
Next
For $i = 1 to $EndDim
    SetmovingRectangle($Copybee[$i], 0, 0, $RectW, $RectH)
next
For $i = 1 to $EndDim
    SetSpriteMovingMode($Copybee[$i], 1)
next
For $i = 1 to $EndDim
    SetSpriteSpeed($Copybee[$i], $Spd, $Spd)
Next
For $i = 1 to $EndDim
    Movesprite($Copybee[$i], Random(-10, -20,1), 800)
    Sleep(10)
next
    SetSpriteSpeed($bee1, $Spd, $Spd)
Sleep($Delay)
;========================= A ========================
$i = 1
$X = 120
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)
Next
$Y=140
For $X = 120 to 200 step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)
Next
$X = 200
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)
Next
$Y = 200
For $X = 120 to 200 step $SprWd + 2
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)
Next
;==================================================
Sleep($Delay)
;======================= U =======================
$X = 230 + 10
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)
Next
$Y=250
For $X = 230 + 10 to 300 + 10 step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$X = 300 + 10
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
;==================================================
Sleep($Delay)
;======================== T =======================
$Y = 140
For $X = 340 to 425  step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$X = 375
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
;=================================================
Sleep($Delay)
;======================== O ========================
$X =  450
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$Y=250
For $X = 450 to 525 step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$X = 525
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$Y=140  
For $X = 450 to 525 step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
;====================================================
Sleep($Delay)
;======================= I =========================
$X = 580
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
;====================================================
Sleep($Delay)
;======================== T =======================
$Y = 140
For $X = 590 + 20 to 670 +20  step $SprWd
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
$X = 630 + 20
For $Y = 140 to 250 step $SprHgt
    MoveSprite($Copybee[$i], $X, $Y)
    $i = $i + 1
    Sleep(1)    
Next
;=================================================
Sleep(1000)

For $i = 1 to $EndDim
    GetSpriteInfos($Copybee[$i])
    $CopybeeX[$i] = $current_X
    $CopybeeY[$i] = $current_Y
    Sleep(100)
Next

While 1
    For $i = 1 to $EndDim
            Movesprite($Copybee[$i], Random(-10, -20,1), 800)
            Sleep(200)
    Next
        
    Sleep(100)
    For $i = 1 to $EndDim
        Movesprite($Copybee[$i], $CopybeeX[$i],$CopybeeY[$i] )
        Sleep(100)  
    Next
    Sleep($Delay)
WEnd

Func _exit()
Exit
EndFunc

Enjoy! :D

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

Link to comment
Share on other sites

New Update !

added Extra options for LoadImage() to define new Width and height

image will be resized to new Width and height

added MouseButton() Capture mousebutton Clicks

added SetMouseXY() Set mouse Position

added SetMouseRect() Set mouse Rectangle

Have fun!

Edited by jpam
Link to comment
Share on other sites

WOW...now that was really cool :)

Next I want to see a game! ^^

Me too! I am eagerly awaiting one really cool game that I know someone will make with all these functions. In the futur I hope to create a game myself :D

Kurt

Awaiting Diablo III..

Link to comment
Share on other sites

I`m working on a simple Breakout game, but was having problems with collision detection, maybe the latest UDF will help... :)

Of course if someone else is doing the same thing, let me know.... :D

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