Dragonfly Q&A

Is it possible to get the score value and use it to set off events?

0 like 0 dislike

I'm aware that it is possible to use getValue() within the Points object to get its value, but it does not work as intended.

The function goes through multiple times in a split second and then stops working entirely, even if a goal value is reached multiple times.

The following is the condition statement I use to pull the score and compare it to the intended score value.

if (getValue() % NUKE_VALUE == 0) {
      /* Event code */


asked Sep 4, 2014 in Tutorial by lrlebrao

1 Answer

0 like 0 dislike

Yes, getValue() returns the value of a ViewObject.  What do you mean "goes through multiple times" ... where did you put the code?  If you put it inside Points::eventHandler() inside the DF_STEP_EVENT code, it will trigger every step.

answered Sep 4, 2014 by claypool
I was having the issue where I was attempting to set off events everytime it reached a number, the problem is that by killing enemies, it was extremely likely to skip the number I was setting to set off the event.
Ah, right.  Score increases by 1 each second (30 steps) and then by 10 each time a Saucer is destroyed.  You may need to adjust the code to use thresholds (i.e., if getValue() > THRESHOLD) then do something.
More information about Dragonfly can be found on the Dragonfly Home Page.