Move an object 30 px

Get help using Construct 2

Post » Thu Dec 20, 2012 3:37 pm

Hi guys!

This time I have an apparent easy question, but this is making me crazy.

Hope somebody is willing to help.

I need to move an object 30 pixel to the right or to the left after a collision with the main character.

I need to use custom movement or (platform) simulate control, cos if I use set position i ll need to take care of collisions with other object and exeptions.

Please help!

Thank you in advance
B
4
Posts: 28
Reputation: 481

Post » Thu Dec 20, 2012 3:44 pm

Hi, you can do this
sprite1 on collision with sprite2- sprite2 setX to sprite2+30

Edit. ok i didn't see the last part of your question but if you do like this,you should turnaround the collisions problem in some other way.cesisco2012-12-20 16:02:29
B
33
S
11
G
9
Posts: 381
Reputation: 10,153

Post » Thu Dec 20, 2012 4:06 pm

Thank you for trying to help me, but as I said its really too messy to take care of the collisions using Set position, cos the stage its made by elements that you can destroy.

So using custom movement and simulate control already take care of collisions.
B
4
Posts: 28
Reputation: 481

Post » Thu Dec 20, 2012 4:28 pm

Lately I've been learning about the marvellous beauty of of Bullet. Mostly have the bullet disabled and turn of angle to motion.

On collision
Bullet.set angle of motion angle(bullet,player)
Bullet enable
Wait x seconds(where as X would be timed to 30px)
Bullet disable

determine how much time you want it to take to travel 30px, then figure how much the bulletspeed should be based on that.
As an example. If you want it to take 1 second to travel 30px
Bulletspeed = 30
WaitTime = 1

30px over half a second
bullet speed 60px
wait time 0.5


boom there you go. 30px
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Thu Dec 20, 2012 4:36 pm

trying it right now
unknowndev2012-12-20 16:37:03
B
4
Posts: 28
Reputation: 481

Post » Thu Dec 20, 2012 4:54 pm

It works very well, thank you so much!
B
4
Posts: 28
Reputation: 481


Return to How do I....?

Who is online

Users browsing this forum: DiabloOvermind, emoticon, MrWhizm, WhosWho and 18 guests