Move an object 30 px

0 favourites
  • 6 posts
From the Asset Store
30 high-quality 2D monsters. This asset is perfect for a side scrolling game, or even a turn based RPG type game.
  • 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

  • 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.

  • 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.

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • trying it right now

  • It works very well, thank you so much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)