Dragonfly Q&A

Score continues rising during "Game Over" sequence/disabling specific collisions

0 like 0 dislike
I'm not quite sure how to go about preventing this from occurring-I thought setting a variable within Points.h and including the file elsewhere would allow me to alter the value (set to true in Hero, false in GameOver) and simply add an "&& if true" to the step() function in Points.cpp, but it seemed I was mistaken on what could be seen from the files.

Further, I've updated my Saucer Shoot to have saucers entering from the top and bottom of the screen, but collisions between this at the borders end up (in most cases) steadily removing the number of saucers spawning.  Is there a way I can disable specifically saucer/saucer collisions?
asked Sep 4, 2014 in Tutorial by jbardonjr
edited Sep 4, 2014 by jbardonjr
Disabling collisions between saucers was an element covered in the tutorial; in particular it was implemented in the game5 or "Explosions" section. Did you alter this code by any chance?

As for the score, could you expand on what you were trying to do and how it didn't work? If setting a variable is a problem, you can probably use a public function to get that information to the class when you want a change to occur -- but I'm not sure what exactly you're having trouble with.
I have the code from the tutorial within Saucer::Hit within the function, with nothing else added to the function but what was covered in the tutorial.

What I was trying to do with the score was have a separate "heroState" value accessible from anything inheriting Hero.h, and only having the score tick up when the state was true.  I was trying to set it to true in the Hero constructor, and to false in the GameOver constructor.

1 Answer

0 like 0 dislike

You could work around Saucer on Saucer collisions, perhaps, by making them SOFT instead of HARD.  This will enable them to receive collisions, which can be handled if they hit a Bullet, but can be ignored if they hit another Saucer.

If Points wants to "see" a variable set elsewhere, it will need a pointer to that Object.   You could make Points itself have an attribute, say "keep_counting", that an external Object could set.  The Hero could have a pointer to Points.  Then, when it died (before markForDelete()), it could tell points to stop counting.  There are other ways to do it, but maybe this gets you started.

 

answered Sep 4, 2014 by claypool
More information about Dragonfly can be found on the Dragonfly Home Page.
...