Computer Science Canada Programming C, C++, Java, PHP, Ruby, Turing, VB   Username:   Password: Wiki   Blog   Search   Turing   Chat Room  Members
Tryna code sepret square going seprate directions
Author Message
Stickman

Posted: 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:

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

Stickman

Posted: 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
scholarlytutor

Posted: 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.
Stickman

Posted: 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.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

Page 1 of 1  [ 4 Posts ]
 Jump to:  Select a forum  CompSci.ca ------------ - Network News - General Discussion     General Forums   -----------------   - Hello World   - Featured Poll   - Contests     Contest Forums   -----------------   - DWITE   - [FP] Contest 2006/2008   - [FP] 2005/2006 Archive   - [FP] 2004/2005 Archive   - Off Topic     Lounges   ---------   - User Lounge   - VIP Lounge     Programming -------------- - General Programming     General Programming Forums   --------------------------------   - Functional Programming   - Logical Programming   - C     C   --   - C Help   - C Tutorials   - C Submissions   - C++     C++   ----   - C++ Help   - C++ Tutorials   - C++ Submissions   - Java     Java   -----   - Java Help   - Java Tutorials   - Java Submissions   - Ruby     Ruby   -----   - Ruby Help   - Ruby Tutorials   - Ruby Submissions   - Turing     Turing   --------   - Turing Help   - Turing Tutorials   - Turing Submissions   - PHP     PHP   ----   - PHP Help   - PHP Tutorials   - PHP Submissions   - Python     Python   --------   - Python Help   - Python Tutorials   - Python Submissions   - Visual Basic and Other Basics     VB   ---   - Visual Basic Help   - Visual Basic Tutorials   - Visual Basic Submissions     Education ----------- - Student Life   Graphics and Design ----------------------- - Web Design     Web Design Forums   ---------------------   - (X)HTML Help   - (X)HTML Tutorials   - Flash MX Help   - Flash MX Tutorials   - Graphics     Graphics Forums   ------------------   - Photoshop Tutorials   - The Showroom   - 2D Graphics   - 3D Graphics     Teams ------ - dTeam Public

 Style: Appalachia blueSilver eMJay subAppalachia subBlue subCanvas subEmjay subGrey subSilver subVereor Search: