How do I change the platform speed in runtime?

Get help using Construct 2

Post » Wed Jun 03, 2015 7:36 am

Hello everyone. just wanna ask how can i change the speed of platform in runtime. Like if a player is collision
with the object.. how can i change its speed?

Many thanks.
B
4
Posts: 8
Reputation: 216

Post » Wed Jun 03, 2015 11:04 am

It depends on the behavior used to make the object move.
If for example you have an object "Platform" that uses the "Bullet" behavior, and you have a "Player" object.

Condition. Player - On collision with "Platform"
Action. Platform - Bullet - Set Bullet Speed to value

The exact answer depends exactly on how you've set your project, and what behaviors you are using.
Consider posting your capx to allow us to answer exactly.
New to Construct ? Where to start

Image Image

Image Image

Please attach a capx to any help request or bug report !
Moderator
B
284
S
109
G
91
Posts: 7,317
Reputation: 87,483

Post » Thu Jun 04, 2015 9:03 am

Message: bobcool15 is not yet permitted to post plain text URLS (300 rep required). 1 URLS removed. Why?
Hello @Kyatric once again thank you for taking time helping me. right now the capx im using is the one coming from
you from this post

And im still learning it, as you said i believe i can achieve this one by working on the "collision" and changing the player
speed in bullet behavior. Have to study it.

By the way, is it possible in construct 2 that once a player collide on a damage obstacle it will decrease its speed lets
say for about 5 seconds and then will goes back to its original speed.

Many thanks! Cheers!
B
4
Posts: 8
Reputation: 216

Post » Thu Jun 04, 2015 9:05 am

@Kyatric oops, sorry. i think i am not allowed yet to post a link. what im reffering is on my other post which is about adding
obstacles. thanks
B
4
Posts: 8
Reputation: 216

Post » Thu Jun 04, 2015 9:55 am

For the 5 seconds question:

Add an instance variable boolean SpeedAdjust and a timer behaviour to your player:

on collision
>player set timer "Bumped" for 5 seconds
>player set boolean SpeedAdjust to true

Player is boolean Speedajust true
> Player set maximum speed

Player on timer "Bumped"
>player set boolean Speedadjust to false
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Jun 04, 2015 10:08 am

In the autorunner example changing the speed can be achieved by changing the bullet-speed of the block-objects..

Create a new global variable BlockSpeed and set it to 300

Player on collison with whatever
> system set variable BlockSpeed to 200
> Block set bullet speed to BlockSpeed

add a new event
Block on created
> Block set bullet speed to BlockSpeed

You should probably also add an event to set the player platform MaxSpeed to BlockSpeed
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Fri Jun 05, 2015 2:10 am

@LittleStain whooohh this is gold! I have to learn to apply this timer to autorunner with random blocks. will let you
know @LittleStain.

Thank you so much!! Cheers!
B
4
Posts: 8
Reputation: 216


Post » Sun Jun 07, 2015 12:37 pm

Thanks for the link @Lordshiva1948 i think i can use those samples in learning construct 2.

By the way i have a separate question hopefully you can help me.

How can i add random obstacles with a number on the center of the object? just like creating 5 obstacles with different color.

e.g obstacle A (triangle) num on the center = 1, color = green
obstacle B (square) num on the center = 2, color = blue
obstacle C (circle) num on the center = 3, color = yellow
obstacle D (rectangle) num on the center = 4, color = red
obstacle E (oblong) num on the center = 5, color = pink

Many thanks.
B
4
Posts: 8
Reputation: 216


Return to How do I....?

Who is online

Users browsing this forum: stevenode and 11 guests