NOT SOLVED|How do I Make Wind That Pushes a Platform Sprite?

Get help using Construct 2

Post » Sat Mar 29, 2014 11:46 pm

How do I Make Wind That Pushes a Platform Sprite? This is my third post about this and no one has helped answer my problem. I want to make a sprite that can push a platform sprite when it comes into contact with it. I have one solution but it has its own problems. I made a transparent sprite with the Solid and Sine behaviors so it constantly pushes the platform sprite away but now the sprite can jump on top of the solid block! HELP PLEASE!
Last edited by HZGaming on Sun Mar 30, 2014 12:29 am, edited 1 time in total.
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Mar 30, 2014 12:00 am

You don't need to make it solid to detect collisions
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sun Mar 30, 2014 12:03 am

I know but that doesn't solve the problem...Its just the only behavior that moves a platform sprite @7Soul
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Mar 30, 2014 12:50 am

The way I would do it, is to control the player movement through its vector.X property, instead of using the "simulate action" command.
Then you can add whatever you want to the speed, like "Set vector.X to player.moveSpeed + windObject.strenght"
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sun Mar 30, 2014 2:05 am

@7Soul Can I just set the vector.X property to 200? Would that move the sprite over 200 pixels?
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Mar 30, 2014 2:11 am

That sets the speed to 200, which means the player moves 200 pixels over 1 second (or around 3 pixels per frame at 60fps)
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sun Mar 30, 2014 2:14 am

So @7Soul would that not work? What would be a preferable and simple way to do it? Btw, I appreciate your help very much :)
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Mar 30, 2014 2:38 am

Add these variables:
On the player add "speedMax" to the maximum speed you want (lets say 100), "currentSpeed" (leave at 0) and "windSpeed" (leave at 0)
On the wind object add "power" an make it a positive or negative number (like 50 or -50) depending on the direction.

Code: Select all
When the player press right
    set "currentSpeed" to "speedMax"

Code: Select all
When the player press left
    set "currentSpeed" to -"speedMax" (notice the - )

Making the player stop:
Code: Select all
Not pressing left and Not pressing right
    set "currentSpeed" to 0

Applying the variables to the speed:
Code: Select all
Every tick
    set player.vectorX to player.currentSpeed + player.windSpeed

Adding the wind speed to the player:
Code: Select all
Player overlapping wind object
    set player.windPower to windObject.power
Else
    set player.windPower to 0
B
84
S
22
G
15
Posts: 1,039
Reputation: 15,249

Post » Sun Mar 30, 2014 2:53 am

:D :D :D Thanks so much!!! You were a enormous help! @7Soul
B
37
S
14
G
3
Posts: 263
Reputation: 4,270

Post » Sun Mar 30, 2014 2:59 am

is there any example capx??
~Everyone can make GAMEs~
B
56
S
12
G
1
Posts: 414
Reputation: 5,911


Return to How do I....?

Who is online

Users browsing this forum: ditocruz, dop2000 and 23 guests