CIS-499-Group3 / Team3-Project

4 stars 2 forks source link

Eating Ghosts #18

Open SpenceSellers opened 8 years ago

SpenceSellers commented 8 years ago

Is anyone working on this? I'll probably give it a shot if nobody else is invested in it.

alan-boggess commented 8 years ago

I'm AFK at the moment (can't push any code), but I had started working on this a little last night.

I was going to implement it via timed events and a "isInvincible" flag on the game itself - on eating a power-up pellet, the game stores the tiles of all active ghosts, destroys them, places new "Scared Ghost" objects on the board (behavior currently still the same as SImpleGhost, but we can correct that later) on those tiles, sets the "isInvincible" flag, and sets a timed event for 10 seconds to do the same but replacing each ghost with the type that ghost originally was (since we've hard-coded specific behaviors to specific ghosts, that won't be hard.) and clearing the "isInvincible" flag.

I hadn't gotten this far, but we can then change the "killPacman" behavior depending on the value of that flag - if it's set, the ghost is destroyed and replaced with a "deadGhost" (another SimpleGhost with different assets) and a timed event is set to replace it in the center. If it's clear, the current behavior in that function occurs.

Since this destroys the ghosts and replaces them on power-up and timeout, we can separate the assets so we don't have the crazy epileptic flashing we currently have. (Or did as of the last pull I made.) Like I said, I hadn't gotten that far, yet, though.

It also might be appropriate to store that flag on the player rather than in the game? Dunno. Thoughts?

Edit: Should mention, I won't be home until 5PM today, so if you wanted to go ahead and get cracking on something like this, be my guest. I haven't implemented the hard part, yet, so you wouldn't hurt my feelings none.

SpenceSellers commented 8 years ago

Sounds good, that's roughly how I was thinking of doing it. I just pushed a commit that made power pellets edible, but they don't have any behavior yet. I'll probably work on making ghosts a bit more fun to play against.

alan-boggess commented 8 years ago

I've sort of implemented this. Destroying the ghosts and replacing them caused some really weird behavior because it was trying to place objects on top of the player, so I've instead added an "afraid" flag to the ghosts and implemented a "runAway" method that they invoke if they are afraid.

There's still some major bugs with it (notably ghost collision still attempts to push the ghosts around and there are some bugs with some of the ghosts transitioning back out of the "afraid" state.) I can't bang my head against this any longer at the moment - hopefully someone else can see what I'm doing wrong.

SpenceSellers commented 8 years ago

There are some bugs, but with being able to eat ghosts I feel like we are now officially and technically done! There's some more optional work we could do before presenting tomorrow but I think we've done everything we promised.

huntrben commented 8 years ago

Technically done is the best kind of done