Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1858,7 +1858,11 @@
" !harness.getObjects('NPC').some((one) => one.id === npc.id),",
" 'The NPC that was talked to is the one that left.'",
");",
"harness.assert(!isDialogOpen(), 'The dialog closes once it is answered.');"
"harness.assert(!isDialogOpen(), 'The dialog closes once it is answered.');",
"",
"// A picture of what the game looks like once this has happened, kept with",
"// the test results.",
"await harness.takeScreenshot('the scene after the NPC agreed to leave');"
]
}
],
Expand Down
6 changes: 5 additions & 1 deletion examples/starting-beatemup/starting-beatemup.json
Original file line number Diff line number Diff line change
Expand Up @@ -2274,7 +2274,11 @@
" knockback > 5,",
" 'The enemy is knocked back away from the player (it moved ' +",
" Math.round(knockback) + 'px).'",
");"
");",
"",
"// A picture of what the game looks like once this has happened, kept with",
"// the test results.",
"await harness.takeScreenshot('the enemy taking the hit');"
]
},
{
Expand Down
6 changes: 5 additions & 1 deletion examples/starting-card-game/starting-card-game.json
Original file line number Diff line number Diff line change
Expand Up @@ -3164,7 +3164,11 @@
" stillOnDeck[0].centerY - deck.centerY",
" ) < 40,",
" 'The new card is on the deck.'",
");"
");",
"",
"// A picture of what the game looks like once this has happened, kept with",
"// the test results.",
"await harness.takeScreenshot('the card that was drawn, in front of the deck');"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4840,7 +4840,11 @@
" harvested,",
" 'Acting on the tree puts a log in the inventory (it holds ' +",
" JSON.stringify(filledSlots()) + ').'",
");"
");",
"",
"// A picture of what the game looks like once this has happened, kept with",
"// the test results.",
"await harness.takeScreenshot('the inventory holding the log that was harvested');"
]
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1337,20 +1337,10 @@
" await harness.stepFrames(3);",
"};",
"",
"/**",
" * Close the dialog if one is open. The game opens one straight away: the",
" * player is spawned overlapping two NPCs, and an NPC counts as \"being talked",
" * to\" by default (see the feedback document), so the level starts with the",
" * dialog up and the player frozen. Saying \"no\" is how a player gets out of",
" * it, and it leaves the game in the state the rest of the test needs.",
" */",
"await harness.stepFrames(3);",
"if (isDialogOpen()) {",
" const dialog = harness.getObjects('TwoChoicesDialogBox')[0];",
" const no = dialog.children.NoButton[0];",
" await clickAt(no.centerX, no.centerY, no.layer);",
"}",
"harness.assert(!isDialogOpen(), 'No dialog is in the way.');",
"// The level starts with nobody being talked to, so the player is free to",
"// walk from the first frame.",
"harness.assert(!isDialogOpen(), 'No dialog is in the way when the level starts.');",
"",
"// Nothing happens on its own: the player only walks when told to.",
"const start = getPlayer();",
Expand Down Expand Up @@ -1457,23 +1447,18 @@
" await harness.stepFrames(3);",
"};",
"",
"// The level starts with a dialog already up (the player is spawned",
"// overlapping two NPCs, and an NPC counts as \"being talked to\" by default —",
"// see the feedback document). Say no to it, which is how a player gets out.",
"await harness.stepFrames(3);",
"if (isDialogOpen()) {",
" const no = getDialog().children.NoButton[0];",
" await clickAt(no.centerX, no.centerY, no.layer);",
"}",
"harness.assert(!isDialogOpen(), 'No dialog is in the way to begin with.');",
"// Nobody is being talked to when the level starts: the dialog below can only",
"// come from the click.",
"harness.assert(!isDialogOpen(), 'No dialog is open before talking to anyone.');",
"",
"const npcsBefore = harness.getObjects('NPC').length;",
"harness.assert(npcsBefore > 0, 'There are NPCs to talk to.');",
"",
"// Click on an NPC standing where the player is: clicking is what picks the",
"// NPC to talk to, and being next to it is what opens the dialog. One of the",
"// NPCs the player spawns on is used, so that the dialog depends on the click",
"// and not on a walk across the level.",
"// Click on an NPC the player is standing next to: clicking is what picks the",
"// NPC to talk to, and being next to it is what opens the dialog. The player",
"// is wide enough to touch two of the NPCs from where it spawns, so one of",
"// those is used and the dialog depends on the click alone.",
"const player = getPlayer();",
"const isWithinReach = (npc) =>",
" Math.abs(npc.centerX - player.centerX) < (npc.width + player.width) / 2 &&",
Expand Down Expand Up @@ -1514,7 +1499,11 @@
" !harness.getObjects('NPC').some((one) => one.id === npc.id),",
" 'The NPC that was talked to is the one that left.'",
");",
"harness.assert(!isDialogOpen(), 'The dialog closes once it is answered.');"
"harness.assert(!isDialogOpen(), 'The dialog closes once it is answered.');",
"",
"// A picture of what the game looks like once this has happened, kept with",
"// the test results.",
"await harness.takeScreenshot('the scene after the NPC agreed to leave');"
]
}
],
Expand Down
Loading