Kurs:FreeBASIC/Forum/Graphik
Aus Wikiversity
< Kurs:FreeBASIC | Forum
[Bearbeiten] Einfache Graphik-Spielerei (Kreis bewegen.bas)
[Bearbeiten] Version 0001
SCREEN 18 Print "Steuerung mit 1 (links), 2 (hoch), 3 (runter) und 4 (rechts)." Dim AS Integer a, b, c, schritt Dim AS String eingabe a = 320 b = 240 schritt = 10 Do Locate 1,1 eingabe = Inkey Select Case eingabe case "1" a = a - schritt c = c + 1 case "2" b = b - schritt c = c + 1 case "3" b = b + schritt c = c + 1 case "4" a = a + schritt c = c + 1 End Select CIRCLE (a, b), 10, c ' Zeichnet einen Kreis wechselnder Farbe (c!) If c = 255 Then c = 1 End If Loop Until Inkey = "x" SLEEP
[Bearbeiten] Version 0002
SCREEN 18 Dim AS Integer a, b, c, schritt Dim AS String eingabe a = 320 b = 240 schritt = 10 Do Locate 1,1 Print "Steuerung mit 1 (links), 2 (hoch), 3 (runter) und 4 (rechts)." Locate 2,1 Print "Abbruch mit x." eingabe = Inkey Select Case eingabe case "1" a = a - schritt c = c + 1 case "2" b = b - schritt c = c + 1 case "3" b = b + schritt c = c + 1 case "4" a = a + schritt c = c + 1 End Select CIRCLE (a, b), 10, c ' Zeichnet einen weißen Kreis If c = 255 Then c = 1 End If Locate 29,1 : Print "Koordinaten: "; a; ", "; b Loop Until Inkey = "x" SLEEP
Man kann einen Kreis über eine Zeichenfläche bewegen. --Michael Reschke 14:37, 20. Jul. 2008 (CEST)

