Sign in to follow this  
Followers 0
Xand3r

can u help me emprove this?

2 posts in this topic

ok so when this loop gets to the last part it moves faster and faster and faster and i don't want i to do that :)

#include<GUIconstants.au3>
Global $g=10
$acc=1
$vit=0.5
$init=100
GUICreate("Gravity emulation" , 50 , 50 , 400 , $init , BitAND($WS_POPUP,$WS_BORDER))
$pos=WinGetPos("Gravity emulation")
GUISetState(@sw_show)
Sleep(1000)
While(1)
    $pos[1]=$pos[1]+$vit
    $vit=$vit+$init/10000000
    WinMove("Gravity emulation" , "" , $pos[0] , $pos[1])
    If($pos[1]>=@DesktopHeight-75) Then 
        $vit=-$vit
        $init=$init+30
        SoundPlay(@WindowsDir&"\media\start.wav")
    EndIf
    If $pos[1]<=$init Then
        $vit=0.5
        WinMove("Gravity emulation" , "" , $pos[0] , $pos[1]+30)
    EndIf
    If($init>@DesktopHeight-75) Then
        MsgBox(0 , "" , "the gui stopped jumping :P")
    Sleep(1000)
    Exit
    EndIf
WEnd

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Share this post


Link to post
Share on other sites



I think that is what it supposed to do... "Gravity emulation"

its the same thing a real ball would do on a hard surface

anyways... this might do the trick

#include<GUIconstants.au3>
Global $g = 10
$acc = 1
$vit = 0.5
$init = 100
$dif = 0
$cnt = 0
GUICreate("Gravity emulation", 50, 50, 400, $init, BitAND($WS_POPUP, $WS_BORDER))
$pos = WinGetPos("Gravity emulation")
GUISetState(@SW_SHOW)
Sleep(1000)
While (1)
    $begin = TimerInit()
    $pos[1] = $pos[1] + $vit
    $vit = $vit + $init / 10000000
    WinMove("Gravity emulation", "", $pos[0], $pos[1])
    If ($pos[1] >= @DesktopHeight - 75) Then
        $vit = -$vit
        $init = $init + 30
        SoundPlay(@WindowsDir & "\media\start.wav")
        $cnt += .15 ;**** maybe 10 to 20
    EndIf
    If $pos[1] <= $init Then
        $vit = 0.5
        WinMove("Gravity emulation", "", $pos[0], $pos[1] + 30)
    EndIf
    If ($init > @DesktopHeight - 75) Then
        MsgBox(0, "", "the gui stopped jumping tongue.gif")
        Sleep(1000)
        Exit
    EndIf
    While $dif < $cnt
        $dif = TimerDiff($begin)
    WEnd
    $dif = 0
WEnd

8)


NEWHeader1.png

Share this post


Link to post
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
Sign in to follow this  
Followers 0