Author |
Message |
canmovie
|
|
|
|
|
Sponsor Sponsor
|
|
|
yoursecretninja
|
Posted: Mon Sep 27, 2010 12:41 pm Post subject: Re: Add 10 to x every loop URGENT HELP PLEASE |
|
|
1. Declare and initialize x prior to entering your loop to make sure that you do not reassign your starting value to the variable.
2. Inside your loop, use the += combined assignment operator. i.e. "x += 5". This allows you to use a variable's value in an expression and assign it the result back to the variable. This is the same as "x = x + 5". So, for x = 10 : x += 5 -> x = 15.
Now x will increment by five each time your run through the loop.
P.S. I don't know Turing. This is just the logic you would use in pretty much any programming language. |
|
|
|
|
|
Dan
|
Posted: Mon Sep 27, 2010 12:52 pm Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
To put what yoursecretninja stated into pesdo code (none turing code used to only express the logic):
code: |
set screen to offscreen only
x = 0
loop
clear screen
x = x + 10
draw animation at X
update screen
end loop
|
Note that you should use the offscreen graphics mode turing supports and update the screen manualy at then end of the loop.
See turing doc for View.set and View.Update:
http://compsci.ca/holtsoft/doc/view_set.html
http://compsci.ca/holtsoft/doc/view_update.html
Also info on loops in turing:
http://compsci.ca/holtsoft/doc/loop.html |
Computer Science Canada
Help with programming in C, C++, Java, PHP, Ruby, Turing, VB and more! |
|
|
|
|
TWizard
|
Posted: Tue Oct 05, 2010 12:07 am Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
*deletia*
Mod Edit: Please do not post complete solutions to problems. This is against [The Rules]. |
|
|
|
|
|
TheGuardian001
|
Posted: Tue Oct 05, 2010 4:10 am Post subject: Re: Add 10 to x every loop URGENT HELP PLEASE |
|
|
Please try not to simply post complete solutions to problems. The goal is to help people accomplish the work, not do it for them. |
|
|
|
|
|
TWizard
|
Posted: Sun Oct 17, 2010 12:47 pm Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
Yea but i find it so much easier. Besides if they really wanted to learn then they can look it up in f10 the guides right there i'm only using what i know didn't know it was such a crime. |
|
|
|
|
|
TheGuardian001
|
Posted: Sun Oct 17, 2010 5:20 pm Post subject: Re: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
TWizard @ Sun Oct 17, 2010 12:47 pm wrote: Yea but i find it so much easier. Besides if they really wanted to learn then they can look it up in f10 the guides right there i'm only using what i know didn't know it was such a crime.
People tend to frown on Plagiarism.
Posting solutions doesn't help anybody. Nobody will learn from copy-pasting your code. The whole point of this site is that when people encounter problems they can't solve simply using the Help Files, we help them figure it out. Not by doing it for them, by helping them figure it out for themselves. |
|
|
|
|
|
TWizard
|
Posted: Wed Oct 20, 2010 8:52 pm Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
I'm just offering a new way of viewing the solution, in my perspective if you have been given a solution and you are able to use it to something that applies to your work or use it to find other ways of getting around the problems then it would be a better asset. Yes it is true that people may have to learn on there own to understand how things work im just offering another way around. And besides it wouldn't be giving the whole answer its the answer that they can use for there problem because giving the exact answer would be to ask for his or her code then fix the problems my self. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
TheGuardian001
|
Posted: Wed Oct 20, 2010 9:13 pm Post subject: Re: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
TWizard @ Wed Oct 20, 2010 8:52 pm wrote: And besides it wouldn't be giving the whole answer
They want to know how to draw a picture 5 pixels over every time the loop goes around.
You gave them a program that draws a picture 5 pixels over every time the loop goes around.
Doing their homework for them from scratch is just as bad, if not even worse, than fixing their program for them. If I ask you
Quote:
How do I find the roots of F(x)=x^2?
The answer is not 0. The answer is set F(x) to 0, and solve for x. Tell them how to do it, don't do it for them. Looking in the back of the book to see the answer might get their homework done, but it won't help them when the test rolls around. |
|
|
|
|
|
Prince Pwn
|
Posted: Sat Oct 23, 2010 2:11 am Post subject: Re: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
TheGuardian001 @ Sun Oct 17, 2010 5:20 pm wrote:
Posting solutions doesn't help anybody. Nobody will learn from copy-pasting your code.
False. I learned how to program by taking source code, modifying it, and seeing how it works. Thanks to that, I now have 2 year computer science diploma. |
|
|
|
|
|
Insectoid
|
Posted: Sat Oct 23, 2010 10:11 am Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
That isn't what TheGuardian001 was implying. He meant 'Nobody will learn from handing in your code' (I assume).
Everybody has looked at and learned from other people's source, if they try to. Too often it happens that someone will just copy & paste the code into their IDE and hand it in, which teaches nothing. |
|
|
|
|
|
TWizard
|
Posted: Sat Oct 23, 2010 5:59 pm Post subject: RE:Add 10 to x every loop URGENT HELP PLEASE |
|
|
Ah right this is an open source site. I was blatly seeing why people where making a big fuss about it. I understand And will try not to do it so much. But thats how i think is just to learn for the awnsers given. |
|
|
|
|
|
|