Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 How do I move an object using case statements?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
zOriginaL




PostPosted: Sat May 08, 2010 5:58 pm   Post subject: How do I move an object using case statements?

What is it you are trying to achieve?
I want to move an object using case statements only. I want to make the object , for example, move to right when the right key is pressed. I want it to continue moving right until another key is pressed.


What is the problem you are having?
I don't know how to do it.

Describe what you have tried to solve this problem
Nothing.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Sat May 08, 2010 6:39 pm   Post subject: Re: How do I move an object using case statements?

Didn't you already post this topic?

And yes. It is. But you would need a case statement for each possible key (since they're in an array). It's easier just to use an if statement instead.
BigBear




PostPosted: Sat May 08, 2010 6:42 pm   Post subject: RE:How do I move an object using case statements?

You can move your object using case statement by accepting user input and evaluating which direction to move it in the form of a case statement.

You object can be a box and you will need variables for the coordinates, and the value of these variables will change depending on the key pressed.

Start with drawing a box with variables in the coordinates accepting user input and changing those variables based on the input

NOTE: case statements are just like if statements
copthesaint




PostPosted: Sat May 08, 2010 6:42 pm   Post subject: Re: How do I move an object using case statements?

http://compsci.ca/v3/viewtopic.php?p=213125&highlight=#213125
zOriginaL




PostPosted: Sat May 08, 2010 11:28 pm   Post subject: Re: How do I move an object using case statements?

TheGuardian001 @ Sat May 08, 2010 6:39 pm wrote:
Didn't you already post this topic?


The other topic I asked if it was possible, this topic I'm asking how to move it =P
Insectoid




PostPosted: Sun May 09, 2010 9:23 am   Post subject: RE:How do I move an object using case statements?

You know what? I don't care if this is slightly different. It's the same topic, same user, same program (I assume). So it should be in the same thread.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: