Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit) (+1)

I've been implementing a simple visual novel game using the Dialogizer module. I wonder if I could render an animation in a canvas using the zazz.flibook while in the "dialog" mode? Let's say I have the following code

`on view do

 alarm.animated: 0

 alarm.show:"none"


 dd.open[deck]

 dd.say[deck.cards["intro_dialogs"].widgets["dialog"].value]

 dd.close[]

end

`

While in `intro_dialogs:dialog` I have something like

`

Phrase 1

Phrase 2

!play:track

Phrase 3

!alarm

`

There is a command handler in the card's script:

`

on command x do

 # alert["" fuse "intro:got command:", x]

 if x like "play:*"

  track:(":" split x)[1]

  if !(track = "stop")

   play[track "loop"] 

  else

   play[0 "loop"]

  end 

 end

 if x~"alarm"

  alarm.animated: 1

  alarm.show:"transparent"

 end

end

`

Where `alarm` is a canvas with the `on view` handler that runs a zazz.flibook. 

Upon reaching the `!alarm`, the alarm canvas becomes visible but no animation. And only after `dd.close[]`, the zazz kicks in. I read in the tutorial that `dd.say` is synchronous – it blocks the global event loop – while it would still call the `on animate` handler every now and then. But, I guess, I can't use zazz in this handler?

(+2)

While Dialogizer is active, the view[] events requested by flagging a widget as .animated won't be produced naturally by Decker itself; all system events are "blocked" until the synchronous call to dd.say[] completes. Dialogizer sends a "synthetic" animate[] event to the current card every frame, and then you can in turn use that event to explicitly send a view[] event to other widgets that need to animate (or call the view[] function on the card, etc).

Perhaps your card script could have something like:

on animate do
 if alarm.animated
  alarm.event["view"]
 end
end

Or maybe you could do something a little more generic, querying the card to find any animated widgets and pump view[] events to them:

on animate do
 (extract value where value..animated from card.widgets)..event["view"]
end

This animate[] event is also how Puppeteer manages the animation for puppets. If you're using these libraries together, make sure your own animate[] event handler calls

pt.animate[deck]

at some point. You can also take a look at the card script for this part of the Dialogizer tutorial: http://beyondloom.com/decker/dialog.html#eventpumping

Does that help?

(+1)

Thank you!

alarm.event["view"] 

does exactly what I need. The event pumping is something I missed when I was looking through tutorials. Thanks again.