I have some students who are blazing along in APCSA and I am assigning them some challenges.
One of them is creating an UNO type card game in the Sandbox.
One of my students is wanting to use graphics (The Theater), but I am uncertain if there is a way to have a back and forth and draw multiple scenes based on ongoing user interaction.
i.e. Draw initial player hand.
Player chooses card to play
Update screen
Player chooses card to play
Update screen
Player chooses … etc.
Since Theater.play() can only be called once, is there a way to make this happen?
Hi @rknapper, sounds like you have some very high achieving students in your class and that is awesome you are providing them with thoughtful extensions! While I have not done this myself, you should be able to draw multiple scenes with just one call to play(). The play() method is overloaded and you can use multiple scenes in the parameters separated by commas or you can have an array of scenes. Check out the documentation here.
Now the trick is what I believe to be the heart of your question: How to separate each scene by triggering it with user interaction?..
How is the user choosing a card to play?
Is it possible to share the project your student has started?
I’ll have to do some more digging but this is a fun project your student is working on.
Best,
-Sam