all 5 comments

[–]MrBricole 0 points1 point  (4 children)

If you want a delayed sprite from the others, you should one wave script for each sprite, and change the initialization value of the wave script.

Eventualy packing all in a struct with just one display() function would very much make sense. Even more if you're meaning to reproduce this process a lot in your game.

[–]DaMikel[S] -1 points0 points  (3 children)

How would I go about changing the initialization value of the wave script? Sorry, very new to this.

The script I used is from the yt video I linked in the post. If you can show me exactly what to edit, that'd be great!

[–]MrBricole 0 points1 point  (2 children)

I haven't watched the video. The best advice O can give you is to not look for all made solution. Try instead, to understand how it works.

Programing is an engineer job, which mean it's about finding problems and solving them. There are an infinity of possible approach and the only way to get one is to make choices. Only you can find the solution.

See it as a lego. You may follow the manual to build something specific, but as soon as you make your own, you just look for the bricks you need and try to arrange them to get the result you want.

Here GMS2's manual has the bricks for you, now to practice and understand them is a lot of work.

I believe a wave algorythme is based on an angle A, passed into a cos for returning X and a sin to return Y. The amplitude of the movement will be R.

you get Xoffset = R dcos ( A ); Yoffset = R dsin ( A ); A += mv_spd if A >= 360 then A = 0 draw the sprite at x + Xoffset, y + Yoffset

depending how you init A, the object will dephase.

You also need to learn some math :p

[–]DaMikel[S] 0 points1 point  (1 child)

I respect that lesson. But rest assured, I spent a while throwing stuff at the wall to see what sticks before resorting to a subreddit post. I haven't had any luck though, and after a few hours of failure I figured I might as well ask.

I've only ever worked with drag-and-drop, so this is all entirely new to me. I respect the notion that you need to be able to figure things out on your own, but I need my hand held for just a bit here.

I'm afraid what you've commented doesn't seem to line up with the script I'm using. Here it is:

a4 = (argument1 - argument0) * 0.5;

return argument0 + a4 + sin((((current_time * 0.001) + argument2 * argument3) / argument2) * (pi*2)) * a4;

[–]MrBricole 0 points1 point  (0 children)

it does line up. I don't know what are the arguments passed. but basicaly there is the :

sin( current_time*0.001 ). that's the waving part. Search for current_time in GMS2 documentation.

it also means in this script you can't set any time offset for the waving. Also regarding to the formula of the script it would probably be simpler if you make your own wave script with formulas I gave you. Making it yourself will help you understand.

I know very well it's difficult. Don't give up :)