Загони кружки в центр

Простая игра, в которой нужно загнать кружки в центр. Сделать это несложно, если учесть, что скорость кружков у всех разная.

Платформы: Linux,Windows
Автор: Caltelt

circlesincenter.png

#INCLUDE "fbgfx.bi"
Using fb

Type Object
    x As Single
    y As Single
    speed As Single
End Type

Screen 13, 8, 2, 0        ' size 13 screen, 8 bit (256 colors), 2 pages, window

Dim circlem As object
Dim enemy1 As object
Dim enemy2 As object
Dim Answer As String

Setmouse 0,0,0

beginning:            ' defines where to goto if you win and restart

circlem.x=150
circlem.y=90           ' Starting positions for all circles and how fast they
circlem.speed=1        ' travel.

enemy1.x=20
enemy1.y=20
enemy1.speed=3

enemy2.x=300
enemy2.y=180
enemy2.speed=2
?
?
?

Print "Get all of the circles within the purple circle to win."
Print "Press any enter to start..."
?
? "Press 'q' or escape to quit."

Sleep


Do
    Cls
    Circle(160,100), 50, 5
    Circle(circlem.x, circlem.y), 10, 15
    Circle(enemy1.x, enemy1.y), 10, 12      ' Creates 1 static and three player
    Circle(enemy2.x, enemy2.y), 10, 10      ' controlled circles, all a different
    ' color.
    If circlem.x>310 Then circlem.x=310   ' sets boundaries so circles cant
    If circlem.x<10 Then circlem.x=10     ' go off the page
    If circlem.y>190 Then circlem.y=190
    If circlem.y<10 Then circlem.y=10

    If enemy1.x>310 Then enemy1.x=310      'boundary
    If enemy1.x<10 Then enemy1.x=10
    If enemy1.y>190 Then enemy1.y=190
    If enemy1.y<10 Then enemy1.y=10

    If enemy2.x>310 Then enemy2.x=310
    If enemy2.x<10 Then enemy2.x=10      ' boundary
    If enemy2.y>190 Then enemy2.y=190
    If enemy2.y<10 Then enemy2.y=10


    If Multikey(sc_up) Then
        circlem.y=circlem.y-circlem.speed
        enemy1.y=enemy1.y-enemy1.speed        ' changes direction based on which
        enemy2.y=enemy2.y-enemy2.speed        ' direction key is pressed
    Endif
    If Multikey(sc_right) Then
        circlem.x=circlem.x+circlem.speed
        enemy1.x=enemy1.x+enemy1.speed
        enemy2.x=enemy2.x+enemy2.speed
    Endif
    If Multikey(sc_down) Then
        circlem.y=circlem.y+circlem.speed
        enemy1.y=enemy1.y+enemy1.speed
        enemy2.y=enemy2.y+enemy2.speed
    Endif
    If Multikey(sc_left) Then
        circlem.x=circlem.x-circlem.speed
        enemy1.x=enemy1.x-enemy1.speed
        enemy2.x=enemy2.x-enemy2.speed
    Endif

    If circlem.x<195 And circlem.x>125 And circlem.y<145 And circlem.y>55 Then
        If enemy1.x<195 And enemy1.x>125 And enemy1.y<145 And enemy1.y>55 Then
            If enemy2.x<195 And enemy2.x>125 And enemy2.y<145 And enemy2.y>55 Then
                Print "      You win! Press 'r' to restart."
                Print "           Or press 'q' to quit."
                If Multikey(sc_r) Then
                    Goto beginning
                Endif
            Endif                    ' All player circles must be within center
        Endif                        ' circle (defined as a square in if..then)
    Endif                            ' to win.

    Sleep 10,1

Loop Until Multikey(sc_Q) Or Multikey(sc_escape)