Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ghost piece - help developing #8

Open
gilzellner opened this issue Aug 12, 2017 · 1 comment
Open

Ghost piece - help developing #8

gilzellner opened this issue Aug 12, 2017 · 1 comment

Comments

@gilzellner
Copy link
Contributor

Hi,
I'm trying to find a simple way to create a ghost piece display.
This is essentially showing the piece where it will fall should you press hard drop that moment.
Recommendations ?

@Nautili
Copy link
Owner

Nautili commented Aug 12, 2017

I would probably try one of two ways. It can be thought of as a simulated drop, so you could create a new piece, drop it all the way down, and then create a drawGhostPiece() function or something similar. If I wrote it this way, I would probably factor out the parts of dropPiece that deal with dropping and the parts that update the game for code reuse, but it's not clear to me that it's any cleaner.

Another way to do it would be to try to take advantage of some other property. Maybe, for each block in the piece, find the distance from that piece to the nearest already placed block below it. Take the minimum of those distances and draw the ghost piece that many blocks down. I think this should be easier to implement than the first option.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants