The Daily Click ::. Forums ::. Klik Coding Help ::. Custom Sinewave
 

Post Reply  Post Oekaki 
 

Posted By Message

Xhunterko



Registered
  07/05/2003
Points
  1015

VIP MemberHas Donated, Thank You!Hasslevania 2!Pokemon Ball!
26th September, 2008 at 01:32:29 -

Hello All!
(For those not bothered with text, the question is at bottom.)

Okay, so, I'm trying to make a puzzle game called firefly. In which, the player controlls a jar using the mouse to catch the bugs around a forest like environment. So, naturally, the bugs move around in a sinewave like movement.

I have a fairly good understanding of how that works (tinkered with an example a while back), but I want to make it to switch between x and y movements smoothly. Allow me to explain with a picture aid.


Image


In this figure, the basic movment pattern for the bugs is number 1. This is very easy to pull off, and they can appear from anywhere on the sides, and go either left or right.

The second movent is when the bugs start climbing up and down the tree. Again, the up and down isn't hard. Its going from the horizontal movent to the vertical movent that I find difficult. Then, in movent number 3, they switch to horizontal again. And in movent number 4, back to vertical movent. Then, under certain conditions, the pattern is reversed and the bug continues along the screen, or finds a new tree.

It gets further complicated in movents 5 and 6. This is because two fireflies are present. In movent 5, they are swirling around one another. In movent 6, they go down the tree, and part ways. One of them however, bounces on the ground and leaves pockets of glow worms.

So, what I want to know is, how do i get it to go from the horizontal, to vertical, and back again? I want it to be a smooth transition. Plus, I would like to know how to accomplish movement number 5. Can anyone help?


Image Edited by the Author.

Image Edited by the Author.

 
All platforming problems can be mostly solved here:

http://www.clickteam.com/mbfiles2/277308-engine.zip
http://www.angelfire.com/games5/psywakd/platform.gam
www.zephni.com

These are very excellent examples by other people and are very informative.
Image

I work at the speed of "maybe".

Coming Soon: Diary Of An Indie Developer
http://www.youtube.com/watch?v=XaF6H9MrgH8

Twitter:
http://twitter.com/xhunterko

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
27th September, 2008 at 04:30:43 -

Lol, what is it with people and sine wave movements? I feel pity for the cosine wave movements

So, um, what was your question again? You seem to imply that you know how to do it but it's complicated. But that means you already know how to do it

Switching between x and y movements is only a matter of using flags.
Flag 0 on: x movement
Flag 1 on: y movement

Want to change the movement, just switch one off and the other on.

Well, bugs don't really move in a sine wave, anyway. Why not make a random movement instead? Like
y=y+Random(3)-Random(3), x=x+3
. It will produce a horizontal movement, where most of the movement will center around the middle, with a few occasional ones to the side.

Image Edited by an Administrator.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Xhunterko



Registered
  07/05/2003
Points
  1015

VIP MemberHas Donated, Thank You!Hasslevania 2!Pokemon Ball!
27th September, 2008 at 09:02:41 -

I tend to make long posts because whenever noobs ask for help. They do so in cryptic, short phrases without explaining they're problem. I'll have to try that though, thanks anyways. Any idea how to get two of them to rotate around each other though? That's the problem i have i think. Thanks again.

 
All platforming problems can be mostly solved here:

http://www.clickteam.com/mbfiles2/277308-engine.zip
http://www.angelfire.com/games5/psywakd/platform.gam
www.zephni.com

These are very excellent examples by other people and are very informative.
Image

I work at the speed of "maybe".

Coming Soon: Diary Of An Indie Developer
http://www.youtube.com/watch?v=XaF6H9MrgH8

Twitter:
http://twitter.com/xhunterko
   

Post Reply



 



Advertisement

Worth A Click