Computer Science Canada

Tryna code sepret square going seprate directions

Author:  Stickman [ Fri May 27, 2022 10:11 am ]
Post subject:  Tryna code sepret square going seprate directions

What is it you are trying to achieve?
<Replace all the <> with your answers/code and remove the <>>


What is the problem you are having?
<Answer Here>


Describe what you have tried to solve this problem
<Answer Here>


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
<Answer Here>

Turing:


<Add your code here>



Please specify what version of Turing you are using
<Answer Here>

Author:  Stickman [ Fri May 27, 2022 10:17 am ]
Post subject:  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 <= 0 then
direction := 1
end if
if y >=maxy - 75 then
direction := 4
elsif y <= 0 then
direction := 3
end if
end loop

Author:  scholarlytutor [ Sat May 28, 2022 8:46 pm ]
Post subject:  Re: Tryna code sepret square going seprate directions

Well, what's the problem you're having? Which part doesn't work? We want to know what you're having trouble with before we go through the effort of testing your code.

Author:  Stickman [ Wed Jun 01, 2022 3:08 pm ]
Post subject:  RE:Tryna code sepret square going seprate directions

im tryna make 2 square go sepret direction, one going up and down and the other going left and right, when runned it going both in the same direction.


: