1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Fresapore

Beiträge von Fresapore

  • Orbit Shooter

    • Fresapore
    • 19. Januar 2012 um 20:17

    Hi Forum!
    Ich veröffentliche hier mal eine Beta-Version meines Spiels Orbit-Shooter.
    Es ist ein einfacher Klon von Orbital.
    Es geht darum, möglichs lange zu "überleben", man schießt mit Kugeln, die an der Stelle, wo sie stehen bleiben, so groß werden bis sie den Rand berühren, und wenn der Schuss über die eigene "Todeslinie" kommt, hat man verloren.
    Implementiert ist "Luftwiederstand" und vektorielles Abprallen von den anderen Kugeln.

    Es ist noch ein bisschen buggy, evtl bleiben die Kugeln in einander stecken, oder bleiben einfach mitten im Flug stehen, probierts aus! ;)

    Danken möchte ich name22, ich habe mir zur Hilfe seine GDI+ Circle Collision angesehen..(aber nicht so ganz nachvollzeihen können und es dann selber überlegt :P)

    Bug: Da ich nicht die FPS errechnen lasse, kann es sein, dass das Spiel auf langsamen Rechnern auch langsamer läuft, und die Geschwindigkeit nicht an die FPS angepasst ist, das ist aber verschmerzbar ;) .


    Hier der Code:

    Spoiler anzeigen
    [autoit]

    #region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_UseX64=n
    #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
    #include <GDIPlus.au3>
    #include <misc.au3>

    [/autoit] [autoit][/autoit] [autoit]

    Opt("GUIOnEventMode", 1)

    [/autoit] [autoit][/autoit] [autoit]

    _GDIPlus_Startup()

    [/autoit] [autoit][/autoit] [autoit]

    Global $hBitmap, $hGraphic, $hBuffer

    [/autoit] [autoit][/autoit] [autoit]

    Global Const $iWidth = 400
    Global Const $iHeight = 600
    Global Const $iFriction = 0.98
    Global Const $iGravitation = 0.1
    Global Const $iBallSpeed = 15

    [/autoit] [autoit][/autoit] [autoit]

    Global $iPoints = "00"
    Global $aAimVect[2]
    Global $iAimDeg = 3.1415 * 0.1
    Global $iDir = -1
    Global $iPlayerMode = -1
    Global $iPlayerTurn

    [/autoit] [autoit][/autoit] [autoit]

    Global $iRadius
    Global $bAimMode = True
    Global $aBall[5] ;X-Pos, Y-Pos, X-Vektor, Y-Vektor, Radius
    Global $iBlocks = 0
    Global $aBlock[5][20] ;X-Pos, Y-Pos, Radius, Pen, Level
    Global $aHitColors[3] = [0xFF00FF00, 0xFFFFFF00, 0xFFFF0000]
    Global $hPen_Size = _GDIPlus_PenCreate($aHitColors[0], 2)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hBrush_String = _GDIPlus_BrushCreateSolid(0xFF00FA00)
    Global $hFormat = _GDIPlus_StringFormatCreate()
    Global $hFamily = _GDIPlus_FontFamilyCreate("impact")
    Global $hFont_Points = _GDIPlus_FontCreate($hFamily, 8, 2)
    Global $hFont_Menu = _GDIPlus_FontCreate($hFamily, 25, 2)
    Global $tLayout_Points = _GDIPlus_RectFCreate($iWidth - 70, $iHeight - 20, 70, 20)
    Global $tLayout_Menu_Single = _GDIPlus_RectFCreate($iWidth / 2 - 100, $iHeight / 4 - 20, 200, 40)
    Global $tLayout_Menu_Multi = _GDIPlus_RectFCreate($iWidth / 2 - 100, ($iHeight / 4) * 3 - 20, 200, 40)
    Global $aInfo_Points = _GDIPlus_GraphicsMeasureString($hGraphic, "Points: 00", $hFont_Points, $tLayout_Points, $hFormat)
    Global $aInfo_Menu_Single = _GDIPlus_GraphicsMeasureString($hGraphic, "Singleplayer", $hFont_Menu, $tLayout_Menu_Single, $hFormat)
    Global $aInfo_Menu_Multi = _GDIPlus_GraphicsMeasureString($hGraphic, "Multiplayer", $hFont_Menu, $tLayout_Menu_Multi, $hFormat)

    [/autoit] [autoit][/autoit] [autoit]

    Global $hBrush_White = _GDIPlus_BrushCreateSolid(0xFFFFFFFF)
    Global $hPen_White = _GDIPlus_PenCreate(0xFFFFFFFF)

    [/autoit] [autoit][/autoit] [autoit]

    $hGui = GUICreate("Orbit-Shooter", $iWidth, $iHeight)
    $Single = GUICtrlCreateLabel("", 0, 0, $iWidth, $iHeight / 2)
    GUICtrlSetOnEvent($Single, "_Single")
    $Multi = GUICtrlCreateLabel("", 0, $iHeight / 2, $iWidth, $iHeight / 2)
    GUICtrlSetOnEvent($Multi, "_Multi")

    [/autoit] [autoit][/autoit] [autoit]

    GUISetState()
    GUISetOnEvent(-3, "_Exit")

    [/autoit] [autoit][/autoit] [autoit]

    $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGui)
    $hBitmap = _GDIPlus_BitmapCreateFromGraphics($iWidth, $iHeight, $hGraphic)
    $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
    _GDIPlus_GraphicsSetSmoothingMode($hBuffer, 2)

    [/autoit] [autoit][/autoit] [autoit]

    While $iPlayerMode < 0
    _GDIPlus_GraphicsClear($hBuffer, 0xFF000000)
    _GDIPlus_GraphicsDrawStringEx($hBuffer, "Singleplayer", $hFont_Menu, $tLayout_Menu_Single, $aInfo_Menu_Single[0], $hBrush_String)
    _GDIPlus_GraphicsDrawStringEx($hBuffer, "Multiplayer", $hFont_Menu, $tLayout_Menu_Multi, $aInfo_Menu_Multi[0], $hBrush_String)
    $aMouseInfo = GUIGetCursorInfo()
    If IsArray($aMouseInfo) Then
    Switch $aMouseInfo[4]
    Case $Single
    _GDIPlus_GraphicsDrawRect($hBuffer, 2, 2, $iWidth - 4, $iHeight / 2 - 4, $hPen_Size)
    Case $Multi
    _GDIPlus_GraphicsDrawRect($hBuffer, 2, $iHeight / 2 + 2, $iWidth - 4, $iHeight / 2 - 4, $hPen_Size)
    EndSwitch
    EndIf
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Sleep(20)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    GUICtrlDelete($Single)
    GUICtrlDelete($Multi)

    [/autoit] [autoit][/autoit] [autoit]

    Do
    Until Not _IsPressed(01)

    [/autoit] [autoit][/autoit] [autoit]

    While True
    _GDIPlus_GraphicsClear($hBuffer, 0xFF000000)
    If $bAimMode Then
    $aAimVect[0] = Cos($iAimDeg) * $iBallSpeed
    $aAimVect[1] = Sin($iAimDeg) * $iBallSpeed
    If $iAimDeg <= 3.1415 * 0.1 Then
    $iDir *= -1
    EndIf
    If $iAimDeg >= 3.1415 * 0.9 Then
    $iDir *= -1
    EndIf
    If Abs($iAimDeg) = 360 Then $iAimDeg = 0
    If $iPlayerMode = 1 Then
    If $iPlayerTurn = 0 Then _GDIPlus_GraphicsDrawLine($hBuffer, $iWidth / 2 + $aAimVect[0] * 40 / $iBallSpeed, $iHeight - $aAimVect[1] * 40 / $iBallSpeed, $iWidth / 2 + $aAimVect[0] * 3, $iHeight - $aAimVect[1] * 3, $hPen_White)
    If $iPlayerTurn = 1 Then _GDIPlus_GraphicsDrawLine($hBuffer, $iWidth / 2 + $aAimVect[0] * 40 / $iBallSpeed, $aAimVect[1] * 40 / $iBallSpeed, $iWidth / 2 + $aAimVect[0] * 3, $aAimVect[1] * 3, $hPen_White)
    Else
    _GDIPlus_GraphicsDrawLine($hBuffer, $iWidth / 2 + $aAimVect[0] * 40 / $iBallSpeed, $iHeight - $aAimVect[1] * 40 / $iBallSpeed, $iWidth / 2 + $aAimVect[0] * 3, $iHeight - $aAimVect[1] * 3, $hPen_White)
    EndIf
    $iAimDeg += $iDir * 0.01
    If _IsPressed(01) Then
    $aBall[4] = 10
    $aBall[0] = $iWidth / 2 - $aBall[4] + (50 / $aAimVect[1]) * $aAimVect[0]
    If $iPlayerTurn = 0 Then
    $aBall[1] = $iHeight - $aBall[4] - 50
    Else
    $aBall[1] = $aBall[4] + 50
    EndIf
    $aBall[2] = $aAimVect[0]
    If $iPlayerTurn = 0 Then
    $aBall[3] = -$aAimVect[1]
    Else
    $aBall[3] = $aAimVect[1]
    EndIf
    $bAimMode = False
    EndIf
    EndIf
    If Not $bAimMode Then
    _CalcCollision()
    _CalcGravitation()
    $aBall[2] *= $iFriction
    $aBall[3] *= $iFriction
    $aBall[0] += $aBall[2]
    $aBall[1] += $aBall[3]
    EndIf
    _GDIPlus_GraphicsDrawLine($hBuffer, 0, $iHeight - 50, $iWidth, $iHeight - 50, $hPen_White)
    If $iPlayerMode = 1 Then _GDIPlus_GraphicsDrawLine($hBuffer, 0, 50, $iWidth, 50, $hPen_White)
    _GDIPlus_GraphicsDrawEllipse($hBuffer, $iWidth / 2 - 40, $iHeight - 40, 80, 80, $hPen_White)
    If $iPlayerMode = 1 Then _GDIPlus_GraphicsDrawEllipse($hBuffer, $iWidth / 2 - 40, -40, 80, 80, $hPen_White)
    If Not $bAimMode Then _GDIPlus_GraphicsFillEllipse($hBuffer, $aBall[0] - $aBall[4], $aBall[1] - $aBall[4], $aBall[4] * 2, $aBall[4] * 2, $hBrush_White)
    For $i = 0 To $iBlocks - 1
    _GDIPlus_GraphicsDrawEllipse($hBuffer, $aBlock[0][$i] - $aBlock[2][$i], $aBlock[1][$i] - $aBlock[2][$i], $aBlock[2][$i] * 2, $aBlock[2][$i] * 2, $aBlock[3][$i])
    Next
    If $iPlayerMode = 0 Then _GDIPlus_GraphicsDrawStringEx($hBuffer, "Points: " & $iPoints, $hFont_Points, $tLayout_Points, $aInfo_Points[0], $hBrush_String)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    If (Not $bAimMode) And (Sqrt($aBall[2] ^ 2 + $aBall[3] ^ 2) < 0.5 Or ((($iPlayerTurn = 0) And ($aBall[1] > $iHeight - 50 - $aBall[4]))) Or (($iPlayerTurn = 1) And ($aBall[1] < 50 + $aBall[4]))) Then
    If ($iPlayerMode = 0) And ($aBall[1] > $iHeight - 50 - $aBall[4]) Then
    MsgBox(0, "Game Over", "Game over" & @CRLF & "You reached " & $iPoints & " Points.")
    Exit
    ElseIf ((($iPlayerTurn = 0) And ($aBall[1] > $iHeight - 50 - $aBall[4]))) Or (($iPlayerTurn = 1) And ($aBall[1] < 50 + $aBall[4])) Then
    MsgBox(0, "Game Over", "Player " & Mod($iPlayerTurn + 1, 2) + 1 & " has won the Game")
    Exit
    EndIf
    $iRadius = 1
    If $iPlayerMode = 1 Then $iPlayerTurn = Mod($iPlayerTurn + 1, 2)
    Do
    _GDIPlus_GraphicsClear($hBuffer, 0xFF000000)
    $iRadius += 1
    For $i = 0 To $iBlocks - 1
    If Sqrt(($aBlock[0][$i] - $aBall[0]) ^ 2 + ($aBlock[1][$i] - $aBall[1]) ^ 2) <= $iRadius + $aBlock[2][$i] Then ExitLoop 2
    Next
    _GDIPlus_GraphicsDrawLine($hBuffer, 0, $iHeight - 50, $iWidth, $iHeight - 50, $hPen_White)
    If $iPlayerMode = 1 Then _GDIPlus_GraphicsDrawLine($hBuffer, 0, 50, $iWidth, 50, $hPen_White)
    _GDIPlus_GraphicsDrawEllipse($hBuffer, $iWidth / 2 - 40, $iHeight - 40, 80, 80, $hPen_White)
    If $iPlayerMode = 1 Then _GDIPlus_GraphicsDrawEllipse($hBuffer, $iWidth / 2 - 40, -40, 80, 80, $hPen_White)
    _GDIPlus_GraphicsDrawEllipse($hBuffer, $aBall[0] - $iRadius, $aBall[1] - $iRadius, $iRadius * 2, $iRadius * 2, $hPen_Size)
    For $i = 0 To $iBlocks - 1
    _GDIPlus_GraphicsDrawEllipse($hBuffer, $aBlock[0][$i] - $aBlock[2][$i], $aBlock[1][$i] - $aBlock[2][$i], $aBlock[2][$i] * 2, $aBlock[2][$i] * 2, $aBlock[3][$i])
    Next
    If $iPlayerMode = 0 Then _GDIPlus_GraphicsDrawStringEx($hBuffer, "Points: " & $iPoints, $hFont_Points, $tLayout_Points, $aInfo_Points[0], $hBrush_String)
    _GDIPlus_GraphicsDrawImageRect($hGraphic, $hBitmap, 0, 0, $iWidth, $iHeight)
    Until ($aBall[0] - $iRadius <= 0) Or ($aBall[0] + $iRadius >= $iWidth) Or ((($iPlayerMode = 0) And ($aBall[1] - $iRadius <= 0)) Or (($iPlayerMode = 1) And ($aBall[1] - $iRadius <= 50))) Or ($aBall[1] + $iRadius >= $iHeight - 50)
    $aBlock[0][$iBlocks] = $aBall[0]
    $aBlock[1][$iBlocks] = $aBall[1]
    $aBlock[2][$iBlocks] = $iRadius
    $aBlock[4][$iBlocks] = 3
    _GDIPlus_PenDispose($aBlock[3][$iBlocks])
    $aBlock[3][$iBlocks] = _GDIPlus_PenCreate($aHitColors[3 - $aBlock[4][$iBlocks]], 3)
    $iBlocks += 1
    $bAimMode = True
    EndIf
    Sleep(10)
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    Func _CalcCollision()
    Local $aTangent[2] ;Vektor der Tangente
    Local $iVector_Scal
    $aBall[0] += $aBall[2]
    $aBall[1] += $aBall[3]
    Local $tmpVect[2] = [$aBall[2], $aBall[3]]
    If $aBall[0] <= $aBall[4] Or $aBall[0] >= $iWidth - $aBall[4] Then
    $aBall[2] *= -1
    Switch $aBall[0] < $iWidth / 2
    Case True
    $aBall[0] = $aBall[4]
    Case False
    $aBall[0] = $iWidth - $aBall[4]
    EndSwitch
    EndIf
    If $iPlayerTurn = 0 Then
    If $aBall[1] <= $aBall[4] + (50 * $iPlayerMode) Then
    $aBall[3] *= -1
    $aBall[1] = $aBall[4] + (50 * $iPlayerMode)
    EndIf
    Else
    If $aBall[1] >= $iHeight - 50 - $aBall[4] Then
    $aBall[3] *= -1
    $aBall[1] = $iHeight - 50 - $aBall[4]
    EndIf
    EndIf
    For $i = 0 To $iBlocks - 1
    If Sqrt(($aBall[0] - $aBlock[0][$i]) ^ 2 + ($aBall[1] - $aBlock[1][$i]) ^ 2) <= $aBall[4] + $aBlock[2][$i] Then
    If $aBall[0] = $aBlock[0][$i] Then
    $aBall[3] *= -1
    ElseIf $aBall[1] = $aBlock[1][$i] Then
    $aBall[2] *= -1
    Else
    $aTangent[0] = ($aBall[1] - $aBlock[1][$i])
    $aTangent[1] = ($aBlock[0][$i] - $aBall[0])
    $iVector_Scal = 2 * (($aTangent[0] * $aBall[2] + $aTangent[1] * $aBall[3]) / ($aTangent[0] ^ 2 + $aTangent[1] ^ 2))
    $aBall[2] = $iVector_Scal * $aTangent[0] - $aBall[2]
    $aBall[3] = $iVector_Scal * $aTangent[1] - $aBall[3]
    EndIf
    If $aBlock[4][$i] > 1 Then
    $aBlock[4][$i] -= 1
    $aBlock[3][$i] = _GDIPlus_PenCreate($aHitColors[3 - $aBlock[4][$i]], 3)
    Else
    For $j = $i + 1 To $iBlocks - 1
    $aBlock[0][$j - 1] = $aBlock[0][$j]
    $aBlock[1][$j - 1] = $aBlock[1][$j]
    $aBlock[2][$j - 1] = $aBlock[2][$j]
    $aBlock[3][$j - 1] = $aBlock[3][$j]
    $aBlock[4][$j - 1] = $aBlock[4][$j]
    Next
    $iBlocks -= 1
    If $iPoints < 9 Then
    $iPoints = "0" & $iPoints + 1
    Else
    $iPoints += 1
    EndIf
    EndIf
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    $aBall[0] -= $tmpVect[0]
    $aBall[1] -= $tmpVect[1]
    EndFunc ;==>_CalcCollision

    [/autoit] [autoit][/autoit] [autoit]

    Func _CalcGravitation()
    Local $iGrav
    Local $aVect[2]
    For $i = 0 To $iBlocks - 1
    $aVect[0] = ($aBlock[0][$i] - $aBall[0]) / Sqrt(($aBlock[0][$i] - $aBall[0]) ^ 2 + ($aBlock[1][$i] - $aBall[1]) ^ 2)
    $aVect[1] = ($aBlock[1][$i] - $aBall[1]) / Sqrt(($aBlock[0][$i] - $aBall[0]) ^ 2 + ($aBlock[1][$i] - $aBall[1]) ^ 2)
    $iGrav = $iGravitation * ($aBlock[2][$i] ^ 2) / (($aBlock[0][$i] - $aBall[0]) ^ 2 + ($aBlock[1][$i] - $aBall[1]) ^ 2)
    $aBall[2] += $iGrav * $aVect[0]
    $aBall[3] += $iGrav * $aVect[1]
    Next
    EndFunc ;==>_CalcGravitation

    [/autoit] [autoit][/autoit] [autoit]

    Func _Exit()
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_BitmapDispose($hBitmap)
    _GDIPlus_FontDispose($hFont_Points)
    _GDIPlus_FontDispose($hFont_Menu)
    _GDIPlus_FontFamilyDispose($hFamily)
    _GDIPlus_StringFormatDispose($hFormat)
    _GDIPlus_BrushDispose($hBrush_String)
    _GDIPlus_BrushDispose($hBrush_White)
    _GDIPlus_PenDispose($hPen_Size)
    _GDIPlus_PenDispose($hPen_White)
    For $i = 0 To $iBlocks - 1
    _GDIPlus_PenDispose($aBlock[3][$i])
    Next
    _GDIPlus_GraphicsDispose($hGraphic)
    _GDIPlus_Shutdown()
    Exit
    EndFunc ;==>_Exit

    [/autoit] [autoit][/autoit] [autoit]

    Func _Single()
    $iPlayerTurn = 0
    $iPlayerMode = 0
    EndFunc ;==>_Single

    [/autoit] [autoit][/autoit] [autoit]

    Func _Multi()
    $iPlayerTurn = 0
    $iPlayerMode = 1
    EndFunc ;==>_Multi

    [/autoit]

    Fresapore

    Dateien

    orbit-shoot.JPG 25,46 kB – 0 Downloads Orbitshoot2.au3 11,73 kB – 398 Downloads
  • Irrlicht kamera mit Charakter richtig ausrichten

    • Fresapore
    • 4. Januar 2012 um 15:52

    Mal ne einfache Maussteuerung:

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_usex64=n

    [/autoit] [autoit][/autoit] [autoit]

    #include <au3Irrlicht2.au3>
    #include <misc.au3>
    #include <math.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", True)
    HotKeySet("{ESC}", "_exit")

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    _IrrStop()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Dim $Camera
    Dim $NodeGround
    Dim $NodeBox
    Dim $aPosition[3] = [0, 100, 0]
    Dim $iDegree = 0
    Dim $iDistance = 300
    Dim $iWidth = @DesktopWidth
    Dim $iHeight = @DesktopHeight
    Dim $MouseXPos

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStart($IRR_EDT_OPENGL, 800, 600, 32, $IRR_WINDOWED, _
    $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrSetWindowCaption("Example 49: Collision in a Loaded Scene")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrChangeWorkingDirectory("../media")
    _IrrLoadScene("CollisionScene.irr")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Camera = _IrrAddCamera($aPosition[0] - 300, $aPosition[1] + 100, $aPosition[2], 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $NodeGround = _IrrGetSceneNodeFromName("Ground")
    $NodeBox = _IrrGetSceneNodeFromName("Pillar")
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])

    [/autoit] [autoit][/autoit] [autoit]

    _IrrHideMouse()
    While _IrrRunning()
    $MouseXPos = MouseGetPos(0)
    MouseMove($iWidth/2, $iHeight/2, 0)
    $iDegree -= ($iWidth/2-$MouseXPos)/5
    _IrrBeginScene(200, 200, 255)
    ;~ If _IsPressed(25) Then
    ;~ $iDegree -= 1
    ;~ _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    ;~ EndIf
    ;~ If _IsPressed(27) Then
    ;~ $iDegree += 1
    ;~ _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    ;~ EndIf
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    If _IsPressed(26) Then
    $aPosition[0] += Cos(_Radian($iDegree)) * 2
    $aPosition[2] -= Sin(_Radian($iDegree)) * 2
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])
    EndIf
    _CalcCamera()
    _IrrDrawScene()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrEndScene()

    [/autoit] [autoit][/autoit] [autoit]

    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStop()

    [/autoit] [autoit][/autoit] [autoit]

    Func _CalcCamera()
    Local $aPos[3]
    $aPos[0] = $aPosition[0] - Cos(_Radian($iDegree)) * $iDistance
    $aPos[2] = $aPosition[2] + Sin(_Radian($iDegree)) * $iDistance
    $aPos[1] = $aPosition[1] + 100
    _IrrSetNodePosition($Camera, $aPos[0], $aPos[1], $aPos[2])
    _IrrSetCameraTarget($Camera, $aPosition[0], $aPosition[1], $aPosition[2])
    Sleep(10)
    EndFunc ;==>_CalcCamera

    [/autoit]

    Das ähnelt jetzt aber einer FPS..usst du wissen, was du dann nimmst. Hier ist pro schleifendurchlauf nur eine Mauspositionsabfrage...

    P.S.: Sleep(1) gibt es nicht, daraus wird sleep(10)

    Fresapore

  • Irrlicht kamera mit Charakter richtig ausrichten

    • Fresapore
    • 3. Januar 2012 um 21:41

    Oha, das mit der Maus wusst ich nicht..das kriegst du so einfach (performant, ohne FPS) nicht hin. Kannst mal das Irrcube (Signatur) angucken, da ist das auch gemacht.
    Naja, mit der linken und rechten Pfeiltaste verändert man die Gradzahl. Durch die Pfeil-nach-oben-taste berechnet man den Anteil in x und in y richtung der Bewegung mithilfe des Sin/cos.
    Y: Sin = Gegenkathete/Hypotenuse --> Gegenkathete = Sin(Winkel)
    X: Cos = Ankathete/Hypothenuse...

    Die Kamera befindet sich auf einem Kreis um das Node. Die Kreiskoordinaten berechnet man ähnlich.
    X = Cos(Winkel) * Radius
    Y = Sin(Winkel) * Radius


    Fresapore

  • Irrlicht kamera mit Charakter richtig ausrichten

    • Fresapore
    • 3. Januar 2012 um 21:11

    Hab dir da mal was gecodet, wenn ich dich richtig verstanden habe:

    Spoiler anzeigen
    [autoit]

    #AutoIt3Wrapper_usex64=n

    [/autoit] [autoit][/autoit] [autoit]

    #include <au3Irrlicht2.au3>
    #include <misc.au3>
    #include <math.au3>

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Opt("MustDeclareVars", True)
    HotKeySet("{ESC}", "_exit")

    [/autoit] [autoit][/autoit] [autoit]

    Func _exit()
    _IrrStop()
    Exit
    EndFunc ;==>_exit

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Dim $Camera
    Dim $NodeGround
    Dim $NodeBox
    Dim $aPosition[3] = [0, 100, 0]
    Dim $iDegree = 0
    Dim $iDistance = 300

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStart($IRR_EDT_OPENGL, 800, 600, 32, $IRR_WINDOWED, _
    $IRR_SHADOWS, $IRR_IGNORE_EVENTS, $IRR_VERTICAL_SYNC_ON)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrSetWindowCaption("Example 49: Collision in a Loaded Scene")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    _IrrChangeWorkingDirectory("../media")
    _IrrLoadScene("CollisionScene.irr")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $Camera = _IrrAddCamera($aPosition[0] - 300, $aPosition[1] + 100, $aPosition[2], 0, 0, 0)

    [/autoit] [autoit][/autoit] [autoit]

    $NodeGround = _IrrGetSceneNodeFromName("Ground")
    $NodeBox = _IrrGetSceneNodeFromName("Pillar")
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])

    [/autoit] [autoit][/autoit] [autoit]

    _IrrHideMouse()

    [/autoit] [autoit][/autoit] [autoit]

    While _IrrRunning()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrBeginScene(200, 200, 255)
    If _IsPressed(25) Then
    $iDegree -= 1
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    EndIf
    If _IsPressed(27) Then
    $iDegree += 1
    _IrrSetNodeRotation($NodeBox, 0, $iDegree, 0)
    EndIf
    If _IsPressed(26) Then
    $aPosition[0] += Cos(_Radian($iDegree)) * 2
    $aPosition[2] -= Sin(_Radian($iDegree)) * 2
    _IrrSetNodePosition($NodeBox, $aPosition[0], $aPosition[1], $aPosition[2])
    EndIf
    _CalcCamera()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrDrawScene()

    [/autoit] [autoit][/autoit] [autoit]

    _IrrEndScene()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    _IrrStop()

    [/autoit] [autoit][/autoit] [autoit]

    Func _CalcCamera()
    Local $aPos[3]
    $aPos[0] = $aPosition[0] - Cos(_Radian($iDegree)) * $iDistance
    $aPos[2] = $aPosition[2] + Sin(_Radian($iDegree)) * $iDistance
    $aPos[1] = $aPosition[1] + 100
    _IrrSetNodePosition($Camera, $aPos[0], $aPos[1], $aPos[2])
    _IrrSetCameraTarget($Camera, $aPosition[0], $aPosition[1], $aPosition[2])
    EndFunc ;==>_CalcCamera

    [/autoit]

    Das muss in den Beispiel-Order, oder du passt die Pfade an..

    Fresapore

  • Irrlicht kamera mit Charakter richtig ausrichten

    • Fresapore
    • 3. Januar 2012 um 20:33

    Das Bild sagt alles :D
    Nimm doch ne normale Kamera, rechne mit Sin/Cos den Abstand zum Node in Abhängigkeit zum Blickwinkel aus und setze das Target der Kamera auf das Node..
    Hab grad keine Zeit, sollte aber machbar sein ;)

    Fresapore

  • Ausklapptext

    • Fresapore
    • 29. Dezember 2011 um 13:21

    Kannst du dir selber basteln. Wenn auf das Label mit dem Plus geklickt wird, die gui vergrößern und ein edit mit den agbs erstellen..

  • Irrlicht vorbereitetes Objekt im Kreis drehen lassen

    • Fresapore
    • 23. Dezember 2011 um 13:31

    Also abgesehen vom modellieren gibt es sehr viele Irrlicht-Beispiele, darunter auch welche wo sich ein Würfel im 3D-Raum dreht...
    Da sollte man eigentlich fündig werden..

  • AskSystem 1.7.3 - Optimierung nötig! :P

    • Fresapore
    • 21. Dezember 2011 um 19:36

    Der Post ist zwei Jahre alt und Sen seit elf Monaten nicht mehr aktiv. Ich halte deine Chancen für relativ gering ;)

  • eure Lieblings-Weinachtslieder

    • Fresapore
    • 20. Dezember 2011 um 18:55

    Nightwish passt immer!
    Bei uns wird immer traditionell Ottmar Liebert gehört :)

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • Fresapore
    • 19. Dezember 2011 um 17:19

    Ich habe Letsgo`s Script mal ein bisschen kommentiert:

    Spoiler anzeigen
    [autoit]

    #include <File.au3>
    GUICreate('Test',400,200) ;Eine einfache Gui wird erzeugt
    $combo=GUICtrlCreateCombo('',30,10,150) ;Der Variablen $Combo wird die ControlID der Combo zugewiesen

    [/autoit] [autoit][/autoit] [autoit]

    $x='' ;$x ist ein (noch) leerer String
    $file=_FileListToArray(@DesktopDir,'*');Das Array $file wird mit den Ordnern und Dateien des Desktops gefüllt
    For $N= 1 to $file[0] ;$file[0] gibt die Anzahl der Funde an, deshalb wiederholt er sooft
    $x&=$file[$n]&'|' ;Dem String $x wird (Getrennt mit '|') der nächste eintrag (Entsprechend der Laufariablen $n) des Arrays $file angehängt
    Next
    GUICtrlSetData($combo,$x) ;Die ComboBox wird auf den Inhlat von $x gesetzt
    GUISetState()

    [/autoit] [autoit][/autoit] [autoit]

    While 1
    $msg=GUIGetMsg()
    if $msg=-3 then Exit
    WEnd

    [/autoit]
  • Umgang mit Arrays - wie validieren und checken?

    • Fresapore
    • 18. Dezember 2011 um 23:28

    Die Anzahl der Einträge kann man mit Ubound() checken ;)
    Also werden Zugriffe oft z.B. so gemacht:

    [autoit]

    For $i = 0 to Ubound($aArray) - 1
    MsgBox(0, "Test", $aArray[$i])
    Next

    [/autoit]

    Lg,
    Fresapore

  • auslesen wie viele Dateien in einem Ordner sind mit Namen Für Combobox

    • Fresapore
    • 18. Dezember 2011 um 22:32

    Sollte gehen mit:

    [autoit]

    $aFolders = _FileListToArray(@DesktopDir, '*', 1)
    For $i = 1 to Ubound($aFolders) - 1
    GuiCtrlSetData($Combo1, $aFolders[$i])
    Next

    [/autoit]

    Lg,
    Fresapore

    Edit: Wohl zu langsam :D

  • Nur einen Script schreiben aber mehrere miteinziehen

    • Fresapore
    • 17. Dezember 2011 um 13:38

    250-300 ist noch untertrieben.
    Schau dir mal "Func" in der Hilfe an. Oder schau dir die Hilfe allgemein mal an ;)
    Auf den ersten Blick fällt mir auf, dass du mehrmals #includes hast mitten im script, die gehören einmal an den Anfang.

    Lg,
    Fresapore

  • X-Mas

    • Fresapore
    • 17. Dezember 2011 um 10:44

    Naja, verlogen finde ich Wheinachten jetzt nicht direkt.
    Klar, der urspüngliche Sinn ist heutzutage verloren gegangen, aber ich freue mich trotzdem auf ein gemütliches Zusammentreffen, Essen und Quatschen mit Verwandten, mit denen ich sonst eher wenig zu tun habe.
    Wenn das alles verlogen ist, finde ich das sehr schade für diese Familie ;)
    (Auf die Geschenke freue ich mich natürlich auch 8o )
    Aber auch nach meinem Gefühl wird die Weihnachtszeit ein wenig sehr gehypt und kommerzialisiert.

    Für mich kommt zwar weder Weihnachtsmann noch Christkind, aber den Weihnachtsmann finde ich schon cooler ;)

  • Absolem - das bin ich!

    • Fresapore
    • 15. Dezember 2011 um 17:41

    Herzlich Willkommen! :)
    Jeder hat sich doch letzendlich hier angemeldet, um seine Fragen zu stellen ;)
    Aber ne UDF wird natürlich immer gerne gesehen :rock:

    Lg,
    Fresapore

  • Mischung aus Rollen- und Schussspiel (MeWar2)

    • Fresapore
    • 14. Dezember 2011 um 13:21
    Zitat

    ausser das soll in 3D sein, dann bist du aber mit AutoIt definitiv auf dem Holzweg


    Naja, ein "Ballerspiel" ohne 3D ist ein bisschen merkwürdig, ausserdem wurden hier auch schon komplexe 3D- Spiele und Simulationen mit Irrlicht gezeigt, das ist durchaus möglich ;)
    Trotzdem muss ich 2$Billie zustimmen, soetwas ist ein bisschen hoch gegriffen :)

    Lg,
    Fresapore

  • eure Lieblings-Weinachtslieder

    • Fresapore
    • 9. Dezember 2011 um 00:26

    Louis Armstrong - Zat You, Santa Claus

    ist ganz lustig. ;)

  • im Explorer markierte Datei - in GUI anzeigen

    • Fresapore
    • 6. Dezember 2011 um 21:23

    Mir fällt nur der überaus unschöne weg ein,
    den Explorer in den Vordergrund holen,
    Str+c senden
    mit Clipget die datei auslesen...

    Aer da geht bestimmt noch was besseres ;)

  • Happy Birthday pee, funkey und Co.

    • Fresapore
    • 4. Dezember 2011 um 15:55

    Hui, so viele auf einmal Ôo
    Alles Gute auch von mir!

  • Größe eines Label oder eines Buttons etc. aus der GUI auslesen

    • Fresapore
    • 2. Dezember 2011 um 00:07

    Das sollte mit Controlgetpos gehen..
    aus der Hilfe Kopiert:

    [autoit]

    $pos = ControlGetPos("Form1", "", "Button1")
    MsgBox(0, "Window Stats:", "POS: " & $pos[0] & "," & $pos[1] & " SIZE: " & $pos[2] & "," & $pos[3] )

    [/autoit]

    Gute Nacht,
    Fresapore ;)

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™