Jump to content

Ball bounce


Josbe
 Share

Recommended Posts

Ball bounce

Just a small example. Physics law.

Part of this algorithm, based from a flashguru.co.uk site, and I tried convert it to AutoIt using the GUI features.

As we know, AutoIt is focused to Window's tasks, but I like experiment with graphics. :)

EDIT: I forgot to mention, try to drag the ball to look the behavior, too.

Ball_bounce.zip

Edited by josbe
Link to comment
Share on other sites

Awesome :).

edit: you might want to turn the ball into a seperate window that is transparent that way it doesn't flicker so much.

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

Already giving my shot at turning this into pong :)

"I thoroughly disapprove of duels. If a man should challenge me, I would take him kindly and forgivingly by the hand and lead him to a quiet place and kill him." - Mark TwainPatient: "It hurts when I do $var_"Doctor: "Don't do $var_" - Lar.
Link to comment
Share on other sites

Hey, that reminds me of

http://www.spikything.plus.com/games/kickups/

Perhaps a modification could be made

Ha ha. I got a highscore of 44 :huh:

By the way your code is sooo cool in my point of view. :D:):D

I hope autoIt can development some algorithm like yours in the future.

This cool thing may attract more users to use and learn AutoIt. Maybe can include in the advance GUI examples in the next release :(:(

[font="Arial"]Thanks[/font]
If @error = me Then $sorry
Else
   Do
      $clarifyMe
   Until $meClear
EndIF
MsgBox(0,"Special Message!","Special Thanks to " & $allHadReplied,$Forever)
Link to comment
Share on other sites

Autoitscript (me) is lucky # 13 using this script at screen size 1280x1024

hotkeyset("{esc}", "stop")
while 1
    $ret = PixelSearch(332, 300, 930, 604, 0x000000, 0, 7)
    if not @error then
        mouseclick("left", $ret[0], $ret[1], 1, 1)
    endif
wend
func stop()
    exit
endfunc

To verify this info go to the game page, click the ball once and submit your score. Plug in a bogus name, and look at what name is #13.

Edited by this-is-me
Who else would I be?
Link to comment
Share on other sites

It was just a fun script I hacked together in about 10 minutes and let it run for about 15 before it finally let the ball drop. If I let it run longer, I am sure it would have gone to the top and been the unbeatble score. Just think of it. Autoitscript could have beaten an elite group of hackers from www.eliteunited.de! In underage terms, "autoit pwns 1337 haxorz 2!!!111one!!!"

Who else would I be?
Link to comment
Share on other sites

I was experimenting with tracking moving pixels. Here is an early test with the game Curveball at http://allthingsflash.com/ag/cb/. I'm still trying more tests to make it work better. I'm sure there are some better search algorithms floating out there.

Edit: It seems to only work right when the browser is maximized. Something to do witht he cood mode. Using 1024x768 res.

Edit: Slight improvment modification

opt("winTitleMatchMode", 2)
opt("pixelCoordMode", 0)

hotkeyset("{esc}", "_stop")

winWaitActive("flash games")

while 1
    $pos = _pixelTrack()
    if not isArray($pos) then
        mouseMove(510, 485, 0)
    else
        mouseMove($pos[0], $pos[1], 0)
    endIf
    sleep(1)
wEnd

func _pixelTrack()
    for $offset = 10 to 150 step 10
        $curPos = mouseGetPos()
        $boxLeft = $curPos[0] - $offset
        $boxTop = $curPos[1] - $offset
        $boxRight = $curPos[0] + $offset
        $boxBottom = $curPos[1] + $offset
        $color = 0xC6FFBD
        $shade = 10
        $precision = 8
        $box = pixelSearch_
            ($boxLeft, $boxTop, $boxRight, $boxBottom, $color, $shade, $precision)
        if not @error then return $box
    next
endFunc

func _stop()
    exit
endFunc

It is only able to get to lvl 8 or so, before it becomes too fast (on my slow comp anyway). That is about how far I can get without using the script.

I'm trying to find a faster search algorithm that doesn't require a math degree to understand.

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

Thread hijack in progress :)

Inspired by this-is-me's post.... but don't cheat or anything :D

0) Download attached swf file.

1) Drag the file into an Internet Explorer window.

2) Right click the black window, and choose Play. Optionally resize window.

3) Run following script which asks you to choose the top-left and bottom-right corners; I recommend clicking BELOW the logo in the upper corner.....

4) Watch script; press Esc to quit.

HotKeySet("{Pause}", "TogglePause")
Global $PAUSED = 0

Opt("MouseCoordMode", 1)
Dim $top_x, $top_y, $bottom_x, $bottom_y
$GUI = GuiCreate("GetCoords...")

ToolTip("Click the top-left corner of the window.")
While 1
    $mouse = GUIGetCursorInfo($GUI)
    If $mouse[2] Then
        $pos = MouseGetPos()
        $top_x = $pos[0]
        $top_y = $pos[1]
        ExitLoop
    EndIf
WEnd

ToolTip('')
Sleep(500)

ToolTip("Click the bottom-right corner of the window.")
While 1
    $mouse = GUIGetCursorInfo($GUI)
    If $mouse[2] Then
        $pos = MouseGetPos()
        $bottom_x = $pos[0]
        $bottom_y = $pos[1]
        ExitLoop
    EndIf
WEnd

ToolTip("Press Esc to quit...", 0, 0)
hotkeyset("{esc}", "stop")
func stop()
    exit
endfunc

while 1
    $ret = PixelSearch($top_x, $top_y, $bottom_x, $bottom_y, 0x000000, 0, 7)
    if not @error then mouseclick("left", $ret[0], $ret[1], 1, 1)
wend


Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

Edit: Added Pause hotkey.

kickups6.zip

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...