pxt-arcade 1.13.11 → 1.13.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/built/common-sim.d.ts +4 -0
  2. package/built/common-sim.js +187 -0
  3. package/built/sim.js +420 -67
  4. package/built/target.js +1 -1
  5. package/built/target.json +1 -1
  6. package/built/targetlight.json +1 -1
  7. package/built/theme.json +1 -1
  8. package/docs/concepts/bouncing-burger.md +5 -5
  9. package/docs/concepts/breadcrumb-trail.md +4 -4
  10. package/docs/concepts/picnic-food.md +6 -6
  11. package/docs/concepts/princess-pizza.md +4 -4
  12. package/docs/concepts/setting-the-scene.md +2 -2
  13. package/docs/concepts/throw-a-bone.md +5 -5
  14. package/docs/concepts/walking-hero.md +3 -3
  15. package/docs/lessons/barrel-dodger.md +3 -3
  16. package/docs/multiplayer-games.md +12 -12
  17. package/docs/projects/SUMMARY.md +6 -6
  18. package/docs/recipes/shark-splash/01-character.md +3 -3
  19. package/docs/recipes/shark-splash/02-A-enemies.md +2 -2
  20. package/docs/recipes/shark-splash/02-enemies.md +5 -5
  21. package/docs/recipes/shark-splash/04-background.md +3 -3
  22. package/docs/recipes/side-scroller/02-create-car.md +2 -2
  23. package/docs/skillmaps.md +2 -0
  24. package/docs/static/badges/badge-adventure-locked.png +0 -0
  25. package/docs/static/badges/badge-adventure.png +0 -0
  26. package/docs/static/skillmap/racer/share.png +0 -0
  27. package/docs/test/skillmap/dino/dino3.md +1 -0
  28. package/docs/test/skillmap/racer/racer1.md +87 -78
  29. package/docs/test/skillmap/racer/racer2.md +50 -55
  30. package/docs/test/skillmap/racer/racer3.md +113 -27
  31. package/docs/test/skillmap/racer.md +69 -0
  32. package/docs/test/skillmap/space/space1.md +205 -0
  33. package/docs/test/skillmap/space/space2.md +186 -0
  34. package/docs/test/skillmap/space/space3.md +374 -0
  35. package/docs/test/skillmap/space/space4.md +409 -0
  36. package/docs/test/skillmap/space/space4a.md +291 -0
  37. package/docs/test/skillmap/space/space5.md +433 -0
  38. package/docs/test/skillmap/space/space6.md +343 -0
  39. package/docs/test/skillmap/space.md +109 -0
  40. package/docs/test/skillmap/star/star1.md +7 -31
  41. package/docs/test/skillmap/star/star2.md +4 -1
  42. package/docs/test/skillmap/star/star4.md +54 -3
  43. package/docs/test/tutorials/birthday.md +2 -2
  44. package/docs/test/tutorials/blazing.md +18 -5
  45. package/docs/tutorials/catch-the-football.md +8 -8
  46. package/docs/tutorials/chase-the-basketball.md +5 -5
  47. package/docs/tutorials/free-throw.md +4 -4
  48. package/package.json +4 -4
  49. package/pxtarget.json +1 -1
  50. package/targetconfig.json +1 -1
@@ -1131,6 +1131,10 @@ declare namespace pxsim.ImageMethods {
1131
1131
  function _drawIcon(img: RefImage, icon: RefBuffer, xy: number, color: number): void;
1132
1132
  function fillCircle(img: RefImage, cx: number, cy: number, r: number, c: number): void;
1133
1133
  function _fillCircle(img: RefImage, cxy: number, r: number, c: number): void;
1134
+ function fillTriangle(img: RefImage, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, c: number): void;
1135
+ function _fillTriangle(img: RefImage, args: RefCollection): void;
1136
+ function fillPolygon4(img: RefImage, x0: number, y0: number, x1: number, y1: number, x2: number, y2: number, x3: number, y3: number, c: number): void;
1137
+ function _fillPolygon4(img: RefImage, args: RefCollection): void;
1134
1138
  function _blitRow(img: RefImage, xy: number, from: RefImage, xh: number): void;
1135
1139
  function blitRow(img: RefImage, x: number, y: number, from: RefImage, fromX: number, fromH: number): void;
1136
1140
  function _blit(img: RefImage, src: RefImage, args: RefCollection): boolean;
@@ -4301,6 +4301,193 @@ var pxsim;
4301
4301
  fillCircle(img, XX(cxy), YY(cxy), r, c);
4302
4302
  }
4303
4303
  ImageMethods._fillCircle = _fillCircle;
4304
+ function nextYRange_Low(x, line, yRange) {
4305
+ while (line.x === x && line.x <= line.x1 && line.x < line.W) {
4306
+ if (0 <= line.x) {
4307
+ if (line.y < yRange.min)
4308
+ yRange.min = line.y;
4309
+ if (line.y > yRange.max)
4310
+ yRange.max = line.y;
4311
+ }
4312
+ if (line.D > 0) {
4313
+ line.y += line.yi;
4314
+ line.D -= line.dx;
4315
+ }
4316
+ line.D += line.dy;
4317
+ ++line.x;
4318
+ }
4319
+ }
4320
+ function nextYRange_HighUp(x, line, yRange) {
4321
+ while (line.x == x && line.y >= line.y1 && line.x < line.W) {
4322
+ if (0 <= line.x) {
4323
+ if (line.y < yRange.min)
4324
+ yRange.min = line.y;
4325
+ if (line.y > yRange.max)
4326
+ yRange.max = line.y;
4327
+ }
4328
+ if (line.D > 0) {
4329
+ line.x += line.xi;
4330
+ line.D += line.dy;
4331
+ }
4332
+ line.D += line.dx;
4333
+ --line.y;
4334
+ }
4335
+ }
4336
+ function nextYRange_HighDown(x, line, yRange) {
4337
+ while (line.x == x && line.y <= line.y1 && line.x < line.W) {
4338
+ if (0 <= line.x) {
4339
+ if (line.y < yRange.min)
4340
+ yRange.min = line.y;
4341
+ if (line.y > yRange.max)
4342
+ yRange.max = line.y;
4343
+ }
4344
+ if (line.D > 0) {
4345
+ line.x += line.xi;
4346
+ line.D -= line.dy;
4347
+ }
4348
+ line.D += line.dx;
4349
+ ++line.y;
4350
+ }
4351
+ }
4352
+ function initYRangeGenerator(X0, Y0, X1, Y1) {
4353
+ const line = {
4354
+ x: X0,
4355
+ y: Y0,
4356
+ x0: X0,
4357
+ y0: Y0,
4358
+ x1: X1,
4359
+ y1: Y1,
4360
+ W: 0,
4361
+ H: 0,
4362
+ dx: X1 - X0,
4363
+ dy: Y1 - Y0,
4364
+ yi: 0,
4365
+ xi: 0,
4366
+ D: 0,
4367
+ nextFuncIndex: 0,
4368
+ };
4369
+ if ((line.dy < 0 ? -line.dy : line.dy) < line.dx) {
4370
+ line.yi = 1;
4371
+ if (line.dy < 0) {
4372
+ line.yi = -1;
4373
+ line.dy = -line.dy;
4374
+ }
4375
+ line.D = 2 * line.dy - line.dx;
4376
+ line.dx = line.dx << 1;
4377
+ line.dy = line.dy << 1;
4378
+ line.nextFuncIndex = 0;
4379
+ return line;
4380
+ }
4381
+ else {
4382
+ line.xi = 1;
4383
+ if (line.dy < 0) {
4384
+ line.D = 2 * line.dx + line.dy;
4385
+ line.dx = line.dx << 1;
4386
+ line.dy = line.dy << 1;
4387
+ line.nextFuncIndex = 1;
4388
+ return line;
4389
+ }
4390
+ else {
4391
+ line.D = 2 * line.dx - line.dy;
4392
+ line.dx = line.dx << 1;
4393
+ line.dy = line.dy << 1;
4394
+ line.nextFuncIndex = 2;
4395
+ return line;
4396
+ }
4397
+ }
4398
+ }
4399
+ function fillTriangle(img, x0, y0, x1, y1, x2, y2, c) {
4400
+ if (x1 < x0) {
4401
+ [x1, x0] = [x0, x1];
4402
+ [y1, y0] = [y0, y1];
4403
+ }
4404
+ if (x2 < x1) {
4405
+ [x2, x1] = [x1, x2];
4406
+ [y2, y1] = [y1, y2];
4407
+ }
4408
+ if (x1 < x0) {
4409
+ [x1, x0] = [x0, x1];
4410
+ [y1, y0] = [y0, y1];
4411
+ }
4412
+ const lines = [
4413
+ initYRangeGenerator(x0, y0, x2, y2),
4414
+ initYRangeGenerator(x0, y0, x1, y1),
4415
+ initYRangeGenerator(x1, y1, x2, y2)
4416
+ ];
4417
+ lines[0].W = lines[1].W = lines[2].W = width(img);
4418
+ lines[0].H = lines[1].H = lines[2].H = height(img);
4419
+ const nextFuncList = [
4420
+ nextYRange_Low,
4421
+ nextYRange_HighUp,
4422
+ nextYRange_HighDown
4423
+ ];
4424
+ const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
4425
+ const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
4426
+ const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
4427
+ const yRange = {
4428
+ min: lines[0].H,
4429
+ max: -1
4430
+ };
4431
+ for (let x = lines[1].x0; x <= lines[1].x1; x++) {
4432
+ yRange.min = lines[0].H;
4433
+ yRange.max = -1;
4434
+ fpNext0(x, lines[0], yRange);
4435
+ fpNext1(x, lines[1], yRange);
4436
+ fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
4437
+ }
4438
+ fpNext2(lines[2].x0, lines[2], yRange);
4439
+ for (let x = lines[2].x0 + 1; x <= lines[2].x1; x++) {
4440
+ yRange.min = lines[0].H;
4441
+ yRange.max = -1;
4442
+ fpNext0(x, lines[0], yRange);
4443
+ fpNext2(x, lines[2], yRange);
4444
+ fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
4445
+ }
4446
+ }
4447
+ ImageMethods.fillTriangle = fillTriangle;
4448
+ function _fillTriangle(img, args) {
4449
+ fillTriangle(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0);
4450
+ }
4451
+ ImageMethods._fillTriangle = _fillTriangle;
4452
+ function fillPolygon4(img, x0, y0, x1, y1, x2, y2, x3, y3, c) {
4453
+ const lines = [
4454
+ (x0 < x1) ? initYRangeGenerator(x0, y0, x1, y1) : initYRangeGenerator(x1, y1, x0, y0),
4455
+ (x1 < x2) ? initYRangeGenerator(x1, y1, x2, y2) : initYRangeGenerator(x2, y2, x1, y1),
4456
+ (x2 < x3) ? initYRangeGenerator(x2, y2, x3, y3) : initYRangeGenerator(x3, y3, x2, y2),
4457
+ (x0 < x3) ? initYRangeGenerator(x0, y0, x3, y3) : initYRangeGenerator(x3, y3, x0, y0)
4458
+ ];
4459
+ lines[0].W = lines[1].W = lines[2].W = lines[3].W = width(img);
4460
+ lines[0].H = lines[1].H = lines[2].H = lines[3].H = height(img);
4461
+ let minX = Math.min(Math.min(x0, x1), Math.min(x2, x3));
4462
+ let maxX = Math.min(Math.max(Math.max(x0, x1), Math.max(x2, x3)), lines[0].W - 1);
4463
+ const nextFuncList = [
4464
+ nextYRange_Low,
4465
+ nextYRange_HighUp,
4466
+ nextYRange_HighDown
4467
+ ];
4468
+ const fpNext0 = nextFuncList[lines[0].nextFuncIndex];
4469
+ const fpNext1 = nextFuncList[lines[1].nextFuncIndex];
4470
+ const fpNext2 = nextFuncList[lines[2].nextFuncIndex];
4471
+ const fpNext3 = nextFuncList[lines[3].nextFuncIndex];
4472
+ const yRange = {
4473
+ min: lines[0].H,
4474
+ max: -1
4475
+ };
4476
+ for (let x = minX; x <= maxX; x++) {
4477
+ yRange.min = lines[0].H;
4478
+ yRange.max = -1;
4479
+ fpNext0(x, lines[0], yRange);
4480
+ fpNext1(x, lines[1], yRange);
4481
+ fpNext2(x, lines[2], yRange);
4482
+ fpNext3(x, lines[3], yRange);
4483
+ fillRect(img, x, yRange.min, 1, yRange.max - yRange.min + 1, c);
4484
+ }
4485
+ }
4486
+ ImageMethods.fillPolygon4 = fillPolygon4;
4487
+ function _fillPolygon4(img, args) {
4488
+ fillPolygon4(img, args.getAt(0) | 0, args.getAt(1) | 0, args.getAt(2) | 0, args.getAt(3) | 0, args.getAt(4) | 0, args.getAt(5) | 0, args.getAt(6) | 0, args.getAt(7) | 0, args.getAt(8) | 0);
4489
+ }
4490
+ ImageMethods._fillPolygon4 = _fillPolygon4;
4304
4491
  function _blitRow(img, xy, from, xh) {
4305
4492
  blitRow(img, XX(xy), YY(xy), from, XX(xh), YY(xh));
4306
4493
  }