
-----------------------------------
Omster
Fri Jun 09, 2017 1:27 pm

Delay Function and Window
-----------------------------------
Hello,
How would you set speeds to 2 different objects? I am trying to make a user-controlled circle animation go faster than another randomly moving circle animation, but the delay function applies to all above it. 
Also, how would I set limits to the x-and-y-coordinates of my circles to prevent them from going off the page?
I am using Turing 4.1.1.
The code is below.
Thanks

var x, y : int
x := 100 
y := 100
var obstx, obsty : int
obstx := 200
obsty := 100
var obstx2, obsty2 : int
obstx2 := 245
obsty2 := 295
var chars: array char of boolean
loop 
    Input.KeyDown (chars)
    if chars (KEY_UP_ARROW) then
        y := y + 2    
    end if
    if chars (KEY_RIGHT_ARROW) then
        x := x + 2
    end if 
    if chars (KEY_LEFT_ARROW) then
        x := x - 2
    end if 
    if chars (KEY_DOWN_ARROW) then
        y := y - 2
    end if 
    cls
    drawfilloval (x, y, 10, 10, blue)
    drawfilloval (obstx, obsty, 20, 20, red)
    drawfilloval (obstx2, obsty2, 20, 20, red)
    obstx := obstx + Rand.Int (-10, 10)
    obsty := obsty + Rand.Int (-10, 10)
    obstx2 := obstx2 + Rand.Int (-10, 10)
    obsty2 := obsty2 + Rand.Int (-10, 10)
    if x >= obstx - 20 & x = obsty2 - 20 & y = obstx - 20 & x = obsty - 20 & y 