123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|583|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Off Topic -> Bobbing About

Wed, 15 Jan 2014, 14:49
spinal
anyone got a nice code snippet to bob a sprite around randomly? have only x,y and framecount to work with, its for collectable objects, low-res game, so need to stay within about 10 pixels of original x,y...

-=-=-
Check out my excellent homepage!
Wed, 15 Jan 2014, 14:49
rockford
Yep. If I get your drift.



Something like that will make the object wobble all over the place.






That will keep the sprite bobbing around it's starting position.
Wed, 15 Jan 2014, 15:18
Jayenkai
Yep, keep it simple. No messy stuff. Not a lot of people have complained about all the enemies in Greenie's Mini Quest being static sprites!!

Alternatively you could use sin/cos to bob the sprite about in a less random manner, but beware of overuse if you're doing that to a lot of sprites at once... Although I'm not sure if that's even something to worry about any more, but i tend to keep it in the back of my mind!!

As an alternative alternative, without moving the sprite at all, even simply rotating it a little, adds a wiggle, which is usually plenty of "movement", or you can randomise the scaling, too.

-=-=-
''Load, Next List!''
Sat, 18 Jan 2014, 03:10
rockford
And...
Sat, 18 Jan 2014, 07:58
spinal
Forgot about this, been using...


-=-=-
Check out my excellent homepage!