Colours and interactive levers


I have 2 questions about coloring objects and controlling 2d levers.

  1. When i have a line and i want to color it to a random colour, then i use “stroke(blue)” and that works well. Later i add “ellipse” and i want it to have a different colour than the line so i write “stroke(red)”. I play my game and both the line and the ellipse is now red. How do I change the ellipse color without changing the line to thesame colour? Do i have to use tint or something?

2.I have a plan of making a flight sim and add som views to it, a 2d cockpit for example. The problem it that i want to be able to move the lever when i swipe with my finger! More advanced: I have imported a leverimage and putting it x=400, y=10. The lever is pointing upwards. Ok, now I take the touch function and write that if you touch (BEGAN and MOVE) at the top of the lever and swipe you finger from x to x, the top of the lever willfolow where you have you finger in the x direction. This without changing that the bottom of the lever is still at x=400. This is what i want but how?

in answer to question 1, change colours between your drawings, like so

draw line
draw ellipse


The second question.

You need to use the touched function to pick up the BEGAN event and test if it is cloe enough to the top of the lever. Then you can use MOVING to track the swipe.