AI, Kinda

Im trying to just make a simple game to simulate typical life from day to do (wild life)

I got to the point where I am adding bugs, specifically lightning bugs, and I got extremely confused -.-

I have nothing to post, just need some theory here. I want to make a lightning bug for a 2D platform like setup, to make it fly around like a lightning bug would. I have the lightning bug lighting up as it should and all that, I just cant figure out how to change the direction and all that well. I really have no idea where to start with this, so any help would be great. Thanks in advance.

http://www.red3d.com/cwr/steer/ has some nice demo applets from which you can choose what you are aiming for, the source however is in c++. Should help you in the right direction though, “wander” might be what youre looking for

You were right, I was looking for wandering, though I’m not quite sure I completely get it.

I know I will need a direction for the main object, and then also a direction that the main object will try to align itself with I guess? How would I manage to convert all that to actually move the object itself? Thats where I get caught up mainly. I’ve never actually tried to move an object with just a direction variable myself. Sorry if it seems like a stupid question. I think I’m missing something completely. -digs into massive brain dump of mathematical equations- I’ll update if I think of something, otherwise, any responses will be helpful!

Well, give them a couple of vectors x and y, move them over time first, get them to move about in straight lines, then
changing direction around in a circle, then you will have the pieces with which to build the wander mechanism.

You need to add a cycle for your game, and repaint what needs to be repainted(moved).
For example you could have a cycle at 200 ms. Each time 200 ms has passed, the program should run trough a painting method, repainting the bug at a different location if it had moved.

I just said 200 ms as it would cause lo lag, but you can make it 30 ms, so it looks more flowing.

how I handle the direction of which I add and subject to x and y is all wrong. Thats my main issue right now.

I’ve seen people around using floating points for this, but I am not exactly sure on how they work with that. Can anyone help me out with that? I know that I will be doing something along the lines of x+=Math.cos(angle); and y+=Math.sin(angle); but I am not sure on how to handle that angle. Ideally Id like to store angle as an int that is just between 0 and 360, just so I can understand it in my mind, but if there is some other way that I must deal with that is fine. Not sure if I am asking this right or not, but hopefully someone will make sense of this nonsense. In my defense, I am confused as hell -.-

You are using 2 different ways to represent the angle, as degrees(0-360) and as radians. to keep it in degrees but treat it as radians let java convert it for you.
Math.sin( Math.toRadians(angle) )

My god. Thank you! That was exactly what I needed. I don’t know how I skipped over even thinking about it that way. That completely fixed my issue and everything is now working as it should. Now all I need is a smart way to keep the stupid object in a certain box, but it all works now, and that is what matters. Thanks everyone for the help. I appreciate it.