Author |
Message |
zOriginaL
|
Posted: Thu Apr 22, 2010 6:53 pm Post subject: Is it possible to move an object with case statements? |
|
|
If so, how? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
ProgrammingFun
|
Posted: Thu Apr 22, 2010 7:00 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
Please elaborate.
It may be possible but it depends on how and why you want it to move.
IMO, if statements are better for animation.
You should answer the questions in the template provided when you create a topic. |
|
|
|
|
|
Insectoid
|
Posted: Thu Apr 22, 2010 7:10 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
Why would you want to?
Anyway, you could do it kind of like this:
code: |
newLocation := case lastLocation
label case1 : valueForCase1
label case2: valueForCase2
end case
drawObject (newLocation)
|
No, I don't know the turing case syntax, but that's the gist of it. If statements are much better in my horribly uninformed and biased opinion. |
|
|
|
|
|
Tony
|
Posted: Thu Apr 22, 2010 11:15 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
@Insectoid: you are thinking too much in Ruby. Turing's case does not return a value. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
SNIPERDUDE
|
Posted: Fri Apr 23, 2010 9:47 am Post subject: RE:Is it possible to move an object with case statements? |
|
|
In Turing, a case statement is just like a crippled if statement. |
|
|
|
|
|
Insectoid
|
Posted: Fri Apr 23, 2010 5:04 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
If it doesn't return a value then how the hell do you use it? Is it only good for calling procedures or something?
@Sniperdude, I agree, though it has its uses. |
|
|
|
|
|
ProgrammingFun
|
Posted: Fri Apr 23, 2010 5:19 pm Post subject: Re: RE:Is it possible to move an object with case statements? |
|
|
Insectoid @ Fri Apr 23, 2010 5:04 pm wrote: If it doesn't return a value then how the hell do you use it? Is it only good for calling procedures or something?
@Sniperdude, I agree, though it has its uses.
Case statements (in Turing) let you do something like the following:
(You can also call procedures, I guess)
Turing: |
var example:int
get example
case example of
label 1: put "You put 1."
label 2: put "You put 2."
label: put "You are boring!"
end case
|
|
|
|
|
|
|
Insectoid
|
Posted: Fri Apr 23, 2010 5:35 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
Oh, lame. Can you replace the 'put' with an assignment at least? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Fri Apr 23, 2010 5:43 pm Post subject: RE:Is it possible to move an object with case statements? |
|
|
short: yes
long:
case
Quote: case expn of
{ label compileTimeExpn {, compileTimeExpn } :
statementsAndDeclarations }
...
|
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
|