Movement - change image
Hi guys. im having a slight problem (this is my first game, so no wonder)
im making this cargame, with an actor (a car) moving by dragging around using touch in the scene.
i did that by following this:
http://www.youtube.com/watch?feature=player_embedded&v=0_3yp8AP2iE
(when touch is pressed - constrain self.position.x to game.touches.touch1.x and
when touch is pressed - constrain self.position.y to game.touches.touch1.y)
then i wanted my image to change when dragging left and right (skid marks for the car )
so i did this:
Rule: if self.motion.linearvelocity.x is greater then 0, change image to [new image].
Rule: if self.motion.linearvelocity.y is less then 0, change image to [new image].
but that doesnt work. is it because there is no velocity upon dragging my actor around with the touch?
if so how do i make this work? please help
thank you guys
im making this cargame, with an actor (a car) moving by dragging around using touch in the scene.
i did that by following this:
http://www.youtube.com/watch?feature=player_embedded&v=0_3yp8AP2iE
(when touch is pressed - constrain self.position.x to game.touches.touch1.x and
when touch is pressed - constrain self.position.y to game.touches.touch1.y)
then i wanted my image to change when dragging left and right (skid marks for the car )
so i did this:
Rule: if self.motion.linearvelocity.x is greater then 0, change image to [new image].
Rule: if self.motion.linearvelocity.y is less then 0, change image to [new image].
but that doesnt work. is it because there is no velocity upon dragging my actor around with the touch?
if so how do i make this work? please help
thank you guys
Comments
You are correct that constraining X,Y won't give you linear velocity. To get linear velocity, you would need to do a different kind of mouse drag (in which you actually constrain linear velocity instead). It goes something like this:
Rule: When touch is pressed:
-- Constrain Attribute: self.motion.Linear Velocity.X To: 50*(( game.Touches.Touch 1.X - self.Position.X )*.5)
-- Constrain Attribute: self.Motion.Linear Velocity.Y To: 50*(( game.Touches.Touch 1.Y - self.Position.Y )*.5)
Hi @michael7@post1.dansknet.dk Firstly to say, it is actually against the rules to include punctuation (except the dash underscore: _ ) in your Forum name; worse still, you've included the @ symbol, something that other members add to your name when referring/writing to you.... (you see how it hasn't worked because of the punctuation & @ you've included) best to change it to something simpler, without punctuation...
You can put your email address in your profile, if you wanted...
OK, your problem: of the top of my head, try this, should work:
Rule: When touch is pressed
Change image to [new image]
constrain attribute self.position.x to game.touches.touch1.x
constrain attribute self.position.y to game.touches.touch1.y
Rule: When touch is released
Change image to [original image]
"No need to make two two posts about the same thing"
- that was not my intention. i just realized i wrote in the wrong categori, and dont know how this forum works quite yet, so i didnt delete the old one.
"Firstly to say, it is actually against the rules to include punctuation (except the dash underscore: _ ) in your Forum name"
- actually this is a name given to me automaticly upon sign up. i will change this to a personal user asap