Using Sin for wave movements?
Hi,
I would like to integrate a wave-like movement for an enemy for shmup game. Similiar to the first enemies in R-Type. (Video Example)
I guess it would be best handled by using sin. But I have never used it before and have no idea how to set it up. So I wanted to ask for some basic explanation how to influence movements with sinus.
I tried this. Just to test how a sin value would influence the movement.
IF
Y pos of (enemy) <=50
THEN
Set X pos to X(enemy)+Sin(0.4)
But nothing at all happened. :p
So it would be really helpful, if someone would give me a basic explanation, about how to integrate sinus as a value for such a movement.
Thanks in advance.
Re: Using Sin for wave movements?
Change your X code to
Set X pos to X("Enemy")+5*sin(Y("Enemy"))
where 5 is the amplitude of the wave.
Re: Using Sin for wave movements?
Here's an example
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=239278#Post2392 78
Just don't use the one labeled "CRASH".
Re: Using Sin for wave movements?
Thanks for the replies.
I now understand how it works and it is a lot of fun, playing around with it. :)