About the car movement

For questions about using Classic.

Post » Fri Aug 21, 2009 3:43 am

I was trying to create my custom car movement so there would be no more bounce but as I was translating my Flash code into Scirra, everything went wrong and it pretty much failed.

I have a few questions because of this:

1)Can you get rid of the 'bounce off walls' feature on the Car Behavior?

2)When you use a 'if key down' statement, does everything in that code occur constantly? I put 'if left is down, add 5 to the speed variable'. That would continuously add 5, correct?
B
2
G
3
Posts: 24
Reputation: 898

Post » Fri Aug 21, 2009 3:58 am

1) You could do that with Events. Can't think of the needed events off the top of my head though

2) Yes. As long as the condition(s) is/are true it will perform the actions. In this case as long as the Left button is down it would add 5 to the variable 'speed'.
B
2
G
3
Posts: 27
Reputation: 904

Post » Fri Aug 21, 2009 4:01 am

[quote="Radyth":17187248]1) You could do that with Events. Can't think of the needed events off the top of my head though

2) Yes. As long as the condition(s) is/are true it will perform the actions. In this case as long as the Left button is down it would add 5 to the variable 'speed'.[/quote:17187248]

1)Okay, I'll see if I can build some behaviors to make it work.

2) Okay, so it will keep increasing if it's held down (5,10,15) correct?
B
2
G
3
Posts: 24
Reputation: 898

Post » Fri Aug 21, 2009 4:06 am

I haven't tried car behavior, so moving on to 2: Yes, "if key down" works like that. As opposed to "key pressed" which triggers only once.

Hmm, actually, about 1: It looks like doing
Sprite ("car" tab) 'On bounce' for a condition, and Sprite ("car" tab) 'Stop' for the action stops the bouncing nicely.
B
3
S
1
G
3
Posts: 82
Reputation: 1,189

Post » Fri Aug 21, 2009 4:13 am

[quote="AshyRaccoon":2eo1j9qa]I haven't tried car behavior, so moving on to 2: Yes, "if key down" works like that. As opposed to "key pressed" which triggers only once.

Hmm, actually, about 1: It looks like doing
Sprite ("car" tab) 'On bounce' for a condition, and Sprite ("car" tab) 'Stop' for the action stops the bouncing nicely.[/quote:2eo1j9qa]


Ah, number one works (except it 'sticks' but that's fine, expected with stop) and 2) I forgot if key down even though I wrote it, I wrote key pressed :|

Problem solved, thanks to everyone who helped!


EDIT: Anyone know how to not make it 'stick' or only make it stop it on the first hit? I tried to find a 'decelerate' expression thingy but didn't seem to find one.
B
2
G
3
Posts: 24
Reputation: 898

Post » Fri Aug 21, 2009 4:29 am

Maybe something like
Sprite: On bounce
System: Compare, Sprite[Car].Speed Greater Than 100
Action > Sprite: Stop

Or maybe using "Set speed" in the car tab.
B
3
S
1
G
3
Posts: 82
Reputation: 1,189

Post » Fri Aug 21, 2009 3:58 pm

[quote="AshyRaccoon":3qypj7q4]Maybe something like
Sprite: On bounce
System: Compare, Sprite[Car].Speed Greater Than 100
Action > Sprite: Stop

Or maybe using "Set speed" in the car tab.[/quote:3qypj7q4]

Hm, I couldn't get your first idea to work, but set speed just makes it keep moving along the axis where it hit (aka it does slow it down but it keeps moving without input)
B
2
G
3
Posts: 24
Reputation: 898

Post » Fri Aug 21, 2009 6:45 pm

You might want to check out the custom movement behavior.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Fri Aug 21, 2009 7:20 pm

blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).
B
2
S
1
G
3
Posts: 102
Reputation: 1,304

Post » Fri Aug 21, 2009 9:32 pm

[quote="Yaraslau":4oozwltp]blankedt, would you mind writing the tutorial? I have the same problem with car behavior, but still have lack in knowledge. So...any tutorial would be great and helpful (even in the form of simple text).[/quote:4oozwltp]
Do you want a tutorial on how to get the car to stop when it hits something?
@newt- I did some research yet still don't know what the custom movement behavior exactly is.
B
2
G
3
Posts: 24
Reputation: 898

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests