Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
how do i get an object to oscillate back and forth (i.e. if i have an enemy on a platform, how do i get it to go back and forth from side to side)?
Develop games in your browser. Powerful, performant & highly capable.
You could try to use the "Move the MovingPlatform object according to a formula" that can be found in your Construct 2 examples folder. I believe it is the Platform 6 example.
You can have it keep moving until it encounters an obstacle, in which case it turns around. You can use solid (other enemies, walls etc.) or invisible sprites (in case of hanging platforms so they don't fall down).
Mipey your suggestion was functional enough for me
Wink i'll play around with the formula and see what i come up with
to make it move nice and smoothly, apply this formula to the X value every tick to move it side to side:
(distance from left edge + modifier * sin(time*modifier))
Play around with the modifier values to get it to move faster and / or further.