
-----------------------------------
zOriginaL
Sat May 08, 2010 5:58 pm

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)

-----------------------------------
TheGuardian001
Sat May 08, 2010 6:39 pm

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
Sat May 08, 2010 6:42 pm

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
Sat May 08, 2010 6:42 pm

Re: How do I move an object using case statements?
-----------------------------------
http://compsci.ca/v3/viewtopic.php?p=213125&highlight=#213125

-----------------------------------
zOriginaL
Sat May 08, 2010 11:28 pm

Re: How do I move an object using case statements?
-----------------------------------
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
Sun May 09, 2010 9:23 am

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.
