Animation question

Need help with using DizzyAGE then look here
Post Reply
Robbington
Your Backpack is Empty
Posts: 18
Joined: Fri Dec 10, 2010 12:22 pm

Animation question

Post by Robbington » Wed Dec 15, 2010 8:19 pm

Back again,

This time with a 'is there a better way of doing this' question.

In short I have a graveyard section in my game, just for asthetics I would like ghosts to appear and dissapear in the background.

I am using a collide object so that when the player enters the room the 'animation' is triggered

Ghost = ObjFind(1000);
ObjSet(Ghost, O_DISABLE, 1);
WaitFrame(100);
ObjSet(Ghost, O_DISABLE, 0);

Ect.

I've tried calling a similar function though UpdateRoom, but that doesnt seem to work, is there a better way of achieving this effect?

Ideally I would like a shimmer effect when they come and go, but I suspect that would involve creating a few more tiles, but after a few rubbish attempts I've decided to leave that until I am better at making the games.

Thanks again

Rob

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Wed Dec 15, 2010 8:27 pm

It depends if you want them called randomly or not. If so, it could be a bit complicated. Possible, but complicated.

regarding shimmering, you can fade them in and out instead. Put this code in your game:

Code: Select all

/////////////////////////////////////////////////////////////////////////////////
// IN: int(fade 0..100)
// fade an object
/////////////////////////////////////////////////////////////////////////////////
func FadeObj( objidx, fade )
{
	color = ObjGet(objidx,O_COLOR); // get the current color of the object
	color = color & 0x00ffffff; // clear alpha component and keep only the rgb
	// compute a new alpha based on the fade value
	alpha = 255 * (100-fade) / 100;
 	color = color | (alpha<<24); // set the new alpha bits in the color
 	ObjSet(objidx,O_COLOR,color); // set the color back to the object
}
then call it when you enable the ghosts using FadeObj( IDX, fade ); where 'fade' is a number between 0 and 100, depending on how you want to fade it. Play around with it and see what you can do anyway.
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Robbington
Your Backpack is Empty
Posts: 18
Joined: Fri Dec 10, 2010 12:22 pm

Post by Robbington » Wed Dec 15, 2010 9:03 pm

Nice,

Thanks for that. Gives a nice effect.

Not to worried about it being random, only got three ghosts in the room, so just a matter of timing so that they appear behind the trees and give a more spooky feel.

Rob

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Wed Dec 15, 2010 9:28 pm

if them being random isn't an issue, then calling them from colliders is probably the easiest way.

Oh and it's alex's code. I first used it in DWD way back in 2007!
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Post Reply