Sprite.forever?
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- typescript
- Domain
- game-dev
Research direction
Start by reviewing the Sprite instance API and game.onUpdateInterval usage shown in the issue. Clarify how a per-sprite forever callback should behave for newly created baddies, including its interval and callback context. Done means the proposed Sprite.forever behavior is specified and implemented with coverage for the relevant lifecycle cases.
Written by the indexing model from the issue text.
Description
I'm always frustrated when I have to write a game loop, it seems very 1980s. Given the asynchronicity of the language I think it would be much cooler to have a forever loop for each instance of a sprite.
For instance, here's a little excerpt from a game I was playing with:
// baddie movement
game.onUpdateInterval(30, function () {
ticks += 1
console.log("T")
if (baddie.x < queen.x) {
baddie.vx = 20
if (ticks > 4) {
baddie.setImage(baddieRight)
}
} else {
baddie.vx = -20
if (ticks > 4) {
baddie.setImage(baddieLeft)
}
}
if (baddie.y < queen.y) {
baddie.y++;
} else if (baddie.y > queen.y) {
baddie.y--;
}
if (ticks == 60) {
ticks = 0
sprites.createProjectileFromSprite(baddieProjectile, baddie, 4 * baddie.vx, 0)
baddie.setImage((baddie.vx) ? baddieRightThrow : baddieLeftThrow)
}
})
Note the comment above: this code is specific to the baddie sprite. Ideally I want this code to run every time there's a baddie created.
When really the code above should "belong" to a sprite and look a little something like this:
// baddie movement
baddie.forever(30, function () {
ticks += 1
.....
this.x++;
.....
})
- Dominant language
- TypeScript
- Stars
- 546
- Forks
- 263
- Avg merge
- 7h 35m
- Merged PRs (30d)
- 46
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/pxt-arcade
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
microsoft/pxt-arcade#7733 · 1 comment ·
-
Theme: Experiments button text has insufficient contrast in the Tokyo Night theme after clicking Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
microsoft/pxt-arcade#7732 · 1 comment ·
-
accessibility keyboardnav p2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/pxt-arcade#7682 ·
-
accessibility
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
microsoft/pxt-arcade#7642 · 1 comment ·
-
enhancement sprite editor
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
microsoft/pxt-arcade#1636 ·
All issues in microsoft/pxt-arcade
Similar issues
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P3
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 76/100
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
vercel/react-tweet#225 ·