Hi,
das folgende Script sollte eig. nur eine erste Grundlage für ein kleines Game sein. Doch komischer Weise bewegt sich der Icon viel schneller, wenn man die Maus bewegt.
Hier das Script:
Spoiler anzeigen
#include <GuiConstantsEx.au3>
Local $b_left = Random ( 1, 500 ), $b_top = Random ( 1, 500 )
Local $gx = Random ( 1, 9 ), $gy = Random ( 1, 9 )
#Region
$Gui = GUICreate( "Reaction", 500, 500 )
GUISetBkColor( 0x000000 )
$ball = GUICtrlCreateIcon( @ScriptDir & "\cursor.ico", 0, $b_left, $b_top, 20, 20)
GUISetState ( @SW_SHOW )
#EndRegion
While 1
$nMsg = GUIGetMsg ()
If $nMsg = $GUI_EVENT_CLOSE Then
Exit
EndIf
_move()
GUICtrlSetPos($ball, $b_left + $gx, $b_top + $gy )
WEnd
Func _move()
if $b_top > 500 - 25 Then
$gy = $gy * -1
EndIf
if $b_top < 1 then
$gy = $gy * -1
EndIf
if $b_left < 1 Then
$gx = $gx * -1
EndIf
if $b_left > 500 - 25 Then
$gx = $gx * -1
EndIf
$b_left = $b_left + $gx
$b_top = $b_top + $gy
EndFunc
Vielen Dank für jegliche Hilfe.
mfG