
-----------------------------------
Stickman
Fri May 27, 2022 10:11 am

Tryna code sepret square going seprate directions
-----------------------------------
What is it you are trying to achieve?



What is the problem you are having?



Describe what you have tried to solve this problem



Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)








Please specify what version of Turing you are using


-----------------------------------
Stickman
Fri May 27, 2022 10:17 am

RE:Tryna code sepret square going seprate directions
-----------------------------------
b r u h ...
anyways here what im tryna do:

tryna make a square go left and right while the other up and down


here the code:
setscreen ("graphics")

var x, y, direction, movement : int

x := 0
y := 0
direction := 1 % 1 means moving right, 2 mean moving left
movement := 10  % when moving left, movement value is -10

loop
    drawfillbox (x, 100, x+75, 180, blue)
    drawfillbox (y, 100, y+75, 180, green)
    delay (50)
    cls
    if direction = 1 then
        movement := 10
    elsif direction = 2 then
        movement := -10
    end if
    
    x := x + movement
    y :=y + movement
    
    if x >=maxx - 75 then
        direction := 2
    elsif x =maxy - 75 then
        direction := 4
    elsif y 