Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Skyost authored Oct 18, 2023
2 parents b4af2be + 276d2b7 commit ba31084
Show file tree
Hide file tree
Showing 12 changed files with 184 additions and 30 deletions.
96 changes: 96 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Bug Report
description: You are creating a Game with Flame but you are noticing some strange behavior, that it throws an unexpected exception, or that it is not working according to the specifications.
title: " "
labels: ["bug"]
assignees: ""
body:
- type: markdown
attributes:
value: |
When reporting a bug, please read this complete template and fill in all the questions in order to get a better response!
- type: textarea
id: what-happened
attributes:
label: What happened?
description: Tell us, what happened?
validations:
required: true

- type: textarea
id: expectation
attributes:
label: What do you expect?
description: Also tell us, what behavior did you expect?
validations:
required: true

# Steps to reproduce

- type: textarea
id: expectation
attributes:
label: How can we reproduce this?
description: This one is very important, please be very precise in how we can reproduce this bug
validations:
required: false

- type: textarea
id: expectation
attributes:
label: What steps should take to fix this?
description: If possible please report steps based on the example from this plugin!
validations:
required: false

- type: textarea
id: expectation
attributes:
label: Do have an example of what change you want?
description: If you can make a minimal reproducible example it is incredibly helpful, the simplest way is to share a link from https://zapp.run, you can start from https://zapp.run/edit/flame where all dependencies are already set up.
validations:
required: false

- type: textarea
id: logs
attributes:
label: Relevant log output
description: If you have any debug / error logging, please fill it here within the code block below
render: shell


- type: markdown
attributes:
label: Execute in a terminal and put output into the code block below
value: ```
Output of: flutter doctor -v
```

# More environment information

- type: markdown
attributes:
label: Create a list of more environment information, like:
value: Flame version: 1.0.0
value: Platform affected: android, ios, web
value: Platform version affected: android 9, ios 13

# More information

- type: textarea
id: expectation
attributes:
label: What do you expect?
description: Do you have any other useful information about this bug report? Please write it down here
validations:
required: false


- type: checkboxes
id: terms
attributes:
label: Are you interested in working on a PR for this?
options:
- label: I want to work on this
required: false

## Possible helpful information: references to other sites/repositories
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## 2023-10-17

### Changes

---

Packages with breaking changes:

- There are no breaking changes in this release.

Packages with other changes:

- [`jenny` - `v1.2.0`](#jenny---v120)

---

#### `jenny` - `v1.2.0`

- **FEAT**: Added lastline before choice ([#2822](https://github.com/flame-engine/flame/issues/2822)). ([3ef52524](https://github.com/flame-engine/flame/commit/3ef525246a0d3b1d02c470b5696164e677cdb6c4))


## 2023-10-12

### Changes
Expand Down
20 changes: 8 additions & 12 deletions doc/tutorials/klondike/app/lib/step2/klondike_game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,15 @@ class KlondikeGame extends FlameGame {
),
);

final world = World()
..add(stock)
..add(waste)
..addAll(foundations)
..addAll(piles);
add(world);
world.add(stock);
world.add(waste);
world.addAll(foundations);
world.addAll(piles);

final camera = CameraComponent(world: world)
..viewfinder.visibleGameSize =
Vector2(cardWidth * 7 + cardGap * 8, 4 * cardHeight + 3 * cardGap)
..viewfinder.position = Vector2(cardWidth * 3.5 + cardGap * 4, 0)
..viewfinder.anchor = Anchor.topCenter;
add(camera);
camera.viewfinder.visibleGameSize =
Vector2(cardWidth * 7 + cardGap * 8, 4 * cardHeight + 3 * cardGap);
camera.viewfinder.position = Vector2(cardWidth * 3.5 + cardGap * 4, 0);
camera.viewfinder.anchor = Anchor.topCenter;
}
}

Expand Down
20 changes: 8 additions & 12 deletions doc/tutorials/klondike/app/lib/step3/klondike_game.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,15 @@ class KlondikeGame extends FlameGame {
),
);

final world = World()
..add(stock)
..add(waste)
..addAll(foundations)
..addAll(piles);
add(world);
world.add(stock);
world.add(waste);
world.addAll(foundations);
world.addAll(piles);

final camera = CameraComponent(world: world)
..viewfinder.visibleGameSize =
Vector2(cardWidth * 7 + cardGap * 8, 4 * cardHeight + 3 * cardGap)
..viewfinder.position = Vector2(cardWidth * 3.5 + cardGap * 4, 0)
..viewfinder.anchor = Anchor.topCenter;
add(camera);
camera.viewfinder.visibleGameSize =
Vector2(cardWidth * 7 + cardGap * 8, 4 * cardHeight + 3 * cardGap);
camera.viewfinder.position = Vector2(cardWidth * 3.5 + cardGap * 4, 0);
camera.viewfinder.anchor = Anchor.topCenter;

final random = Random();
for (var i = 0; i < 7; i++) {
Expand Down
5 changes: 3 additions & 2 deletions packages/flame/lib/src/collisions/collision_passthrough.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:meta/meta.dart';
Expand All @@ -14,9 +15,9 @@ mixin CollisionPassthrough on CollisionCallbacks {
@mustCallSuper
void onMount() {
super.onMount();
passthroughParent = ancestors().firstWhere(
passthroughParent = ancestors().firstWhereOrNull(
(c) => c is CollisionCallbacks,
) as CollisionCallbacks;
) as CollisionCallbacks?;
}

@override
Expand Down
20 changes: 19 additions & 1 deletion packages/flame/test/collisions/collision_passthrough_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flame/collisions.dart';
import 'package:flame/components.dart';
import 'package:flame/src/collisions/collision_passthrough.dart';
import 'package:flame_test/flame_test.dart';
import 'package:test/test.dart';

import 'collision_test_helpers.dart';
Expand Down Expand Up @@ -40,5 +41,22 @@ void main() {
expect(hitboxParent.onCollisionCounter, 1);
},
});

testWithFlameGame('Null passthrough', (game) async {
final hitbox = CompositeHitbox(children: [RectangleHitbox()]);
final component = PositionComponent(children: [hitbox]);
final testBlock = TestBlock(Vector2.zero(), Vector2.all(10));

await game.addAll([component, testBlock]);
await game.ready();

expect(hitbox.passthroughParent, isNull);

hitbox.removeFromParent();
testBlock.add(hitbox);
await game.ready();

expect(hitbox.passthroughParent, testBlock);
});
});
}
4 changes: 4 additions & 0 deletions packages/flame_jenny/jenny/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.2.0

- **FEAT**: Added lastline before choice ([#2822](https://github.com/flame-engine/flame/issues/2822)). ([3ef52524](https://github.com/flame-engine/flame/commit/3ef525246a0d3b1d02c470b5696164e677cdb6c4))

## 1.1.1

- **REFACTOR**: Remove unnecessary 'async' keyword across the codebase [DCM] ([#2803](https://github.com/flame-engine/flame/issues/2803)). ([2dfe0e5a](https://github.com/flame-engine/flame/commit/2dfe0e5a431213c7148ab6389e3e8c8dc49fbf3d))
Expand Down
14 changes: 14 additions & 0 deletions packages/flame_jenny/jenny/lib/src/parse/parse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,16 @@ class _Parser {
if (lines.isNotEmpty && lines.last is DialogueChoice) {
(lines.last as DialogueChoice).options.add(option);
} else {
if (lines.isNotEmpty && lines.last is DialogueLine) {
final lastLine = lines.removeLast() as DialogueLine;
lines.add(
DialogueLine(
content: lastLine.content!,
character: lastLine.character,
tags: [...lastLine.tags, '#lastline'],
),
);
}
lines.add(DialogueChoice([option]));
}
} else if (nextToken == Token.startCommand) {
Expand Down Expand Up @@ -912,8 +922,11 @@ class _Parser {
}

bool takeId() => takeTokenType(TokenType.id);

bool takeText() => takeTokenType(TokenType.text);

bool takePerson() => takeTokenType(TokenType.person);

bool takeNewline() {
if (position >= tokens.length) {
return true;
Expand Down Expand Up @@ -967,6 +980,7 @@ class _Parser {

class _NodeHeader {
_NodeHeader(this.title, this.tags);

String? title;
Map<String, String>? tags;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ class DialogueLine extends DialogueEntry {
final LineContent _content;
String? _value;

/// The content of this Line.
LineContent? get content => _content;

/// The character who is speaking the line. This can be null if the line does
/// not contain a speaker.
Character? get character => _character;
Expand Down
2 changes: 1 addition & 1 deletion packages/flame_jenny/jenny/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: jenny
description: YarnSpinner equivalent for Dart.
version: 1.1.1
version: 1.2.0
homepage: https://github.com/flame-engine/flame/tree/main/packages/flame_jenny/jenny
funding:
- https://opencollective.com/blue-fire
Expand Down
7 changes: 6 additions & 1 deletion packages/flame_jenny/jenny/test/dialogue_runner_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ void main() {
test('dialogue with choices', () async {
final yarn = YarnProject()
..parse('title: X\n---\n'
'Question?\n'
'-> Hi there\n'
'-> Howdy\n'
' Greetings to you too\n'
Expand All @@ -138,6 +139,8 @@ void main() {
[
'[*] onDialogueStart()',
'[*] onNodeStart(Node(X))',
'[*] onLineStart(DialogueLine(Question?)[#lastline])',
'[*] onLineFinish(DialogueLine(Question?))',
'[*] onChoiceStart(DialogueChoice([Option(Hi there), ' +
'Option(Howdy), Option(Yo! #disabled)])) -> 1',
'[*] onChoiceFinish(Option(Howdy))',
Expand All @@ -157,6 +160,8 @@ void main() {
[
'[*] onDialogueStart()',
'[*] onNodeStart(Node(X))',
'[*] onLineStart(DialogueLine(Question?)[#lastline])',
'[*] onLineFinish(DialogueLine(Question?))',
'[*] onChoiceStart(DialogueChoice([Option(Hi there), ' +
'Option(Howdy), Option(Yo! #disabled)])) -> 0',
'[*] onChoiceFinish(Option(Hi there))',
Expand Down Expand Up @@ -373,7 +378,7 @@ class _RecordingDialogueView extends DialogueView {

@override
FutureOr<bool> onLineStart(DialogueLine line) =>
_record('onLineStart($line)');
_record('onLineStart($line${line.tags.isNotEmpty ? line.tags : ""})');

@override
void onLineFinish(DialogueLine line) => _record('onLineFinish($line)');
Expand Down
2 changes: 1 addition & 1 deletion packages/flame_jenny/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
flame: ^1.10.0
flutter:
sdk: flutter
jenny: ^1.1.1
jenny: ^1.2.0
meta: ^1.9.1

dev_dependencies:
Expand Down

0 comments on commit ba31084

Please sign in to comment.