« Return to Thread: Manual Questions

Re: Manual Questions

by Christian Walther :: Rate this Message:

Reply to Author | View in Thread

> I want pipmak as soon as leaves a specific node, show the small fram  
> in the
> middle of the page and start over the game. well, I supposed  
> something like
> this work:
>
> img = pipmak.newimage("congratulations.jpg") // picture file is in  
> the node
> folder
>
> onleavenode(
> function
>
> slide(img)
>
> end
> )
>
> but this gives me an error:attemp to call global slide ( a nil value).

"slide" is not a function that you can call at any time to create a  
slide node out of thin air. It is only used at the top level of a  
node.lua file to describe that particular node, and is only defined at  
the time the node.lua file is read. It is technically a function but  
you shouldn't think of it as one, rather as a statement in a  
declarative node description language. (I know that statements like  
the 'local img = something; slide (img)' I proposed blur that notion,  
that's why I consider them inelegant and confusing. The slide  
statement is really intended to be used only as 'slide "imagename"' or  
'slide {"imagename", more stuff}'.)

I'm a bit confused by your desire to display a third node when the  
player moves from one node to another (rather than at some other time  
determined by your game code). Do you want the move to be canceled and  
the popup displayed above the old node, or should it be displayed on  
top of the new node? (Are there several possibilities of what the new  
node can be? If there's only one, it would seem more natural to me to  
do this in the code that triggers the leaving than in the onleavenode  
handler. Or in the new node on entering.)

Here's how displaying it on top of the new node should work:

onleavenode(
   function()
     pipmak.overlaynode(123) -- node 123 is your popup
   end
)

   -Christian

------------------------------------------------------------------------------
_______________________________________________
Pipmak-Users mailing list
Pipmak-Users@...
news://news.gmane.org/gmane.games.devel.pipmak.user
https://lists.sourceforge.net/lists/listinfo/pipmak-users

 « Return to Thread: Manual Questions