DizzyAGE General Coding Queries

Need help with using DizzyAGE then look here
delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

DizzyAGE General Coding Queries

Postby delta » Sat Feb 09, 2008 11:40 pm

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.
Image

Image

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

xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1006
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Postby xelanoimis » Sun Feb 10, 2008 8:08 am

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).

GGower
Your Backpack is Empty
Posts: 3
Joined: Sat Mar 01, 2008 11:38 am

Postby GGower » Sat Mar 01, 2008 12:25 pm

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: .

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

Postby delta » Sat Mar 01, 2008 12:52 pm

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 handlers.gs 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
      {
         ObjSet(idx,O_DISABLE,1);
         SamplePlay(FX_BEEP1);
         return; // don't hurt
      }
   }
   PlayerHurt(3);
   if(PlayerGet(P_LIFE)==0)
      PlayerSet(P_DEATH, ObjGet(idx,O_DEATH));
   return;
}


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.
Image



Image



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

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

Postby delta » Sat Mar 01, 2008 12:55 pm

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.
Image



Image



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

GGower
Your Backpack is Empty
Posts: 3
Joined: Sat Mar 01, 2008 11:38 am

Postby GGower » Sat Mar 01, 2008 1:12 pm

Thanks I'll give it a go later on :v2_dizzy_happy:

xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1006
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Postby xelanoimis » Sat Mar 01, 2008 5:35 pm

Also, make sure you go through the DizzyAGE book:
http://www.yolkfolk.com/dizzyage/books/dizzyage/page00_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.
Alex

Have a look at the "How To" articles too:
http://www.yolkfolk.com/dizzyage/articles.html

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

Postby delta » Sun Mar 02, 2008 2:10 pm

I've noticed a small error in the default game. at the top of game.gs, 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 player.gs 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:
Image



Image



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

xelanoimis
Team Yolkfolk
Team Yolkfolk
Posts: 1006
Joined: Sun Jan 21, 2007 6:34 pm
Contact:

Postby xelanoimis » Mon Mar 03, 2008 1:26 pm

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);

where
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.

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

Postby delta » Mon Mar 03, 2008 8:33 pm

yes it does work, my point is that in the game.gs file at the top, where it tells you what commands you can use, it calls it

RespawnPlayer_

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



Image



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