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
Early prototype: track and replay sprite property changes #24044
Conversation
# Conflicts: # apps/src/gamelab/GameLab.js
# Conflicts: # apps/src/gamelab/GameLab.js
|
||
for (let prop of trackedProps) { | ||
const descriptor = Object.getOwnPropertyDescriptor(sprite, prop) || {}; | ||
Object.defineProperty(sprite, prop, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be a great place to use an ES6 Proxy but unfortunately it's not supported in IE11 😕.
Are you sure this is the level at which you want to log/replay data? My impression was that we would log input events, and just rerun the student's code against that. |
No, not sure yet 😄. I think that approach could work well also, if we can align input events to a specific frame (for deterministic playback). Track that I press the screen at location How does scrubbing backwards work in that approach? |
That's a good question. I suppose scrubbing backwards is a lot easier if you actually have a recording of the world's state at every frame. I think ultimately we'll want to store both sets of data? |
Sample usage:
replay(__mostRecentGameLabInstance);
in the console.I'm only tracking a few properties (x, y, tint) so far.