Page 1 of 72

DizzyAGE General Coding Queries

Posted: Sat Feb 09, 2008 11:40 pm
by delta
I'm starting this thread because there's no-where to ask general questions people may have about coding in DizzyAGE.

so... my question is, is there any way of putting an animated tile onto the HUD? i tried using the same code it uses to display the lifebar tile, but the tile just stays at the first frame.

any thoughts? it's not essential, i just thought it'd be nice.

Posted: Sun Feb 10, 2008 8:08 am
by xelanoimis
check the parameters for HudDrawTile in the docs
the last one is the tile's frame, so you'll have to advance it by hand
try like frame = GameGet(G_FRAME), I think it will be clamped at the
max tile's frames. If not, do that with a modulo operation (%maxframes).

Posted: Sat Mar 01, 2008 12:25 pm
by GGower
Hi. I've been poaching about with DizzyAge for a while. At first I was dreading about putting my fingers into script, but I have managed to achieve a few simple things. I was looking at PTeal's work on Magicland about killing the ghosts with the power pill (Hope you don't mind :v2_dizzy_smile :) . But when I try to implement it from scratch myself, I am unsuccessful. Could someone explain how I can do this simply. Be gentle I'm far from dab hand, hopefully I'd be able to make my own fan game sometime :v2_dizzy_happy: .

Posted: Sat Mar 01, 2008 12:52 pm
by delta
this is a fairly simple bit of code, but only when you know how!

you need to have the brush type of the 'ghost' set as dynamic, with the collider property set to 'call handler' so that it calls the handler when dizzy collides with it, and also set the Death property to a number (for example 1). this enables you to identify the ghost in the handler, and also enables you to have custom text should the 'ghost' hurt and kill you. You also need to have the Class property set to either hurt or kill. (oh and don't forget to give the 'ghost' an ID number.)

then you need to modify part of the HandlerCollision() function in the script file, to read something like the following code. i'll assume the powerpill is object ID 1000.

Code: Select all

if(ObjGet(idx,O_CLASS)==CLASS_HURT && mode!=0) // hurt objects
	if(ObjGet(idx,O_DEATH)==1) // death cause is ghost
		if(InventoryFind(ObjFind(1000))!=-1) // powerpill is in the inventory
			return; // don't hurt
		PlayerSet(P_DEATH, ObjGet(idx,O_DEATH));
compare the bit of code above with the HandlerCollision() function in the default handler. if the item has a class of 'hurt', what the extra bit of code does is firstly identify if the object collided with has a Death property of 1. if it does, then it then looks if the powerpill (ID 1000) is in the inventory. if it is, it disables the item you've collided with (the ghost), beeps, and stops the handler from going any further (using return; ). if either of those isn't true, it will bypass the extra code and harm the player.

Posted: Sat Mar 01, 2008 12:55 pm
by delta
oh and don't worry about looking at other games and using part of the code, it's one reason why DizzyAGE is open-source, so that others can look, learn, and copy, in order to help them with their own games.

Posted: Sat Mar 01, 2008 1:12 pm
by GGower
Thanks I'll give it a go later on :v2_dizzy_happy:

Posted: Sat Mar 01, 2008 5:35 pm
by xelanoimis
Also, make sure you go through the DizzyAGE book: ... 0_toc.html
There is basic stuff explained in there, enough for a simple game.
Once you get the basics, it will be much easy to get an idea about other puzzles.
And if you need more help, feel free to ask.

Have a look at the "How To" articles too:

Posted: Sun Mar 02, 2008 2:10 pm
by delta
I've noticed a small error in the default game. at the top of, it says the function to use for custom death sequences is 'RespawnPlayer_DEATH()' where DEATH is the number of the P_DEATH/O_DEATH property.

only problem is, when seaching for this function, the file looks for 'PlayerRespawn_DEATH()', which, of course, it's never going to find...

took me quite a while to figure out why my custom death function wasn't working.... :p needless to say, it now is.

along with 99% of the game. *is nearly finished* :v2_dizzy_yahoo:

Posted: Mon Mar 03, 2008 1:26 pm
by xelanoimis
I'm not sure what you mean.
The code of the PlayerLoseLife() function that searches for the respawn callback does:

fid = gs_fid("PlayerRespawn_"+(str)death);
if(fid!=-1) call(fid);

death = PlayerGet(P_DEATH);

so the resulted callback name sould be like for example:

"PlayerRespawn_10" if you've been killed by a death type of 10

And so does work for me in TOS.

Posted: Mon Mar 03, 2008 8:33 pm
by delta
yes it does work, my point is that in the file at the top, where it tells you what commands you can use, it calls it


which doesn't work, as i realised after about 15mins of trying to figure out why it wasn't being called. :p