Skip to content

Commit

Permalink
new commit
Browse files Browse the repository at this point in the history
  • Loading branch information
devpedrofurquim committed Nov 2, 2024
1 parent ef6b10f commit ff7a60c
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 30 deletions.
Binary file added assets/images/Background/clouds.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/Background/new_sky.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/Terrain/levelOne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/levelOne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions assets/images/levelOne.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.11.0" name="levelOne" tilewidth="16" tileheight="16" tilecount="242" columns="22">
<image source="tiles/levelOne.png" width="352" height="176"/>
</tileset>
4 changes: 4 additions & 0 deletions assets/levelOne.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<tileset version="1.10" tiledversion="1.11.0" name="levelOne" tilewidth="16" tileheight="16" tilecount="242" columns="22">
<image source="tiles/levelOne.png" width="352" height="176"/>
</tileset>
29 changes: 17 additions & 12 deletions assets/tiles/Level-01.tmx
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="40" height="23" tilewidth="16" tileheight="16" infinite="0" nextlayerid="4" nextobjectid="32">
<map version="1.10" tiledversion="1.11.0" orientation="orthogonal" renderorder="right-down" width="40" height="23" tilewidth="16" tileheight="16" infinite="0" nextlayerid="5" nextobjectid="32">
<tileset firstgid="1" name="Moonshiner" tilewidth="16" tileheight="16" tilecount="242" columns="22">
<image source="../images/Terrain/Terrain (16x16).png" width="352" height="176"/>
</tileset>
<tileset firstgid="243" source="Moonshiner2.tsx"/>
<tileset firstgid="243" name="New Terrain" tilewidth="16" tileheight="16" tilecount="242" columns="22">
<image source="../images/Terrain/Terrain (16x16)2.png" width="352" height="176"/>
</tileset>
<tileset firstgid="485" source="Houses(16x16).tsx"/>
<tileset firstgid="749" name="levelOne" tilewidth="16" tileheight="16" tilecount="242" columns="22">
<image source="levelOne.png" width="352" height="176"/>
</tileset>
<layer id="1" name="Background" width="40" height="23">
<properties>
<property name="BackgroundColor" value="Gray"/>
Expand All @@ -18,24 +23,24 @@
24,24,24,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,24,24,24,
24,24,24,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,24,24,24,
24,24,24,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,24,24,24,
24,24,112,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,24,24,24,
24,24,112,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,112,24,24,
24,24,112,113,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111,112,24,24,
24,24,112,113,243,244,245,246,247,248,249,250,251,252,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,262,263,264,111,112,112,24,
24,24,112,113,265,266,267,268,269,270,271,272,273,274,265,266,267,268,269,270,271,272,273,274,275,276,277,278,279,280,281,282,283,284,285,286,111,24,112,24,
24,24,112,113,771,772,773,774,775,776,777,778,779,780,781,782,783,784,785,786,787,788,789,790,791,792,0,0,0,0,787,788,789,790,791,792,111,24,24,24,
24,24,112,113,793,794,795,796,797,798,799,800,801,802,803,804,805,806,807,808,809,810,811,812,813,814,802,803,804,805,809,810,811,812,813,814,111,112,24,24,
24,24,112,113,815,816,817,818,819,820,821,822,823,824,825,826,827,828,829,830,831,832,833,834,835,836,824,825,826,827,831,832,833,834,835,836,111,112,24,24,
24,24,112,113,837,838,839,840,841,842,843,844,845,846,847,848,849,850,851,852,853,854,855,856,857,858,846,847,848,849,853,854,855,856,857,858,111,112,112,24,
24,24,112,113,859,860,861,862,863,864,865,866,867,868,869,870,871,872,873,874,875,876,877,878,879,880,868,869,870,871,875,876,877,878,879,880,111,24,112,24,
24,24,112,113,287,288,289,290,291,292,293,294,295,296,297,298,299,300,301,302,303,304,305,306,307,308,299,300,301,302,303,304,305,306,307,308,111,24,24,24,
24,24,112,113,309,310,311,312,313,314,315,316,317,318,319,320,321,322,323,324,325,326,327,328,329,330,321,322,323,324,325,326,327,328,329,330,111,24,24,24,
24,24,24,113,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,343,344,345,346,347,348,349,350,351,352,111,24,24,24,
24,24,24,113,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,431,432,433,434,435,436,437,438,439,440,111,24,24,24,
24,24,24,113,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,453,454,455,456,457,458,459,460,461,462,111,24,24,24,
24,24,24,113,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,475,476,477,478,479,480,481,482,483,484,111,24,24,24,
24,24,24,113,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,431,432,433,434,435,436,437,952,953,954,111,24,24,24,
24,24,24,113,441,442,443,444,445,446,447,448,449,450,451,452,453,454,455,456,457,458,459,460,461,462,453,454,455,456,457,458,459,446,447,448,111,24,24,24,
24,24,24,113,463,464,465,466,467,468,469,470,471,472,473,474,475,476,477,478,479,480,481,482,483,484,475,476,477,478,479,480,481,468,469,470,111,24,24,24,
24,24,24,114,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,115,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,112,112,112,112,112,112,112,112,112,112,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,
24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24
</data>
</layer>
<objectgroup id="2" name="SpawnPoints">
<objectgroup id="2" name="SpawnPoints" visible="0">
<object id="5" name="Player" type="Player" x="480" y="224" width="32.1917" height="31.0211"/>
<object id="14" name="Lamp" type="Objects" x="128" y="224" width="32" height="32"/>
<object id="17" name="Paper" type="Objects" x="224" y="224" width="32" height="32"/>
Expand All @@ -50,7 +55,7 @@
<object id="29" name="Door" type="Door" x="416" y="144" width="48" height="64"/>
<object id="31" name="Wife" type="Wife" x="528" y="208" width="32.1917" height="31.0211"/>
</objectgroup>
<objectgroup id="3" name="Collisions">
<objectgroup id="3" name="Collisions" visible="0">
<object id="6" x="48" y="48" width="16" height="272"/>
<object id="7" x="48" y="304" width="544" height="16"/>
<object id="8" x="576" y="48" width="16" height="256"/>
Expand Down
Binary file added assets/tiles/levelOne.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 9 additions & 9 deletions lib/components/background_tile.dart
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import 'dart:async';

import 'package:flame/components.dart';
import 'package:flame/parallax.dart';
import 'package:flutter/cupertino.dart';

class BackgroundTile extends ParallaxComponent {
final String color;
BackgroundTile({
this.color = 'Gray',
position,
}) : super(
position: position,
);

final double scrollSpeed = 10;
final double scrollSpeed = 1;

@override
FutureOr<void> onLoad() async {
priority = -1;
size = Vector2.all(64);
parallax = await game.loadParallax(
[ParallaxImageData('Background/$color.png')],
baseVelocity: Vector2(-scrollSpeed, 0),
repeat: ImageRepeat.repeat,
fill: LayerFill.none);
[
ParallaxImageData('Background/new_sky.png'), // Use the new image
],
baseVelocity:
Vector2(-scrollSpeed, 0), // Adjust scroll speed if necessary
repeat: ImageRepeat.repeatX, // Only repeat horizontally
fill: LayerFill.height, // Stretch to fill the screen height
);
return super.onLoad();
}
}
29 changes: 29 additions & 0 deletions lib/components/clouds.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import 'dart:async';
import 'package:flame/components.dart';
import 'package:flame/parallax.dart';
import 'package:flutter/cupertino.dart';

class Clouds extends ParallaxComponent {
Clouds({
position,
}) : super(
position: position,
);

final double cloudScrollSpeed = 10; // Adjust for desired cloud speed

@override
FutureOr<void> onLoad() async {
priority = -1;
parallax = await game.loadParallax(
[
ParallaxImageData(
'Background/clouds.png'), // Make sure you have a clouds image
],
baseVelocity: Vector2(-cloudScrollSpeed, 0),
repeat: ImageRepeat.repeatX,
fill: LayerFill.height, // Stretch to fill the screen height
);
return super.onLoad();
}
}
18 changes: 9 additions & 9 deletions lib/components/level.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flame/game.dart';
import 'package:flame_tiled/flame_tiled.dart';
import 'package:moonshiner_game/components/background_tile.dart';
import 'package:moonshiner_game/components/baker.dart';
import 'package:moonshiner_game/components/clouds.dart';
import 'package:moonshiner_game/components/collision_block.dart';
import 'package:moonshiner_game/components/journalGuy.dart';
import 'package:moonshiner_game/components/oldLady.dart';
Expand Down Expand Up @@ -69,15 +70,14 @@ class Level extends World with HasGameRef<Moonshiner> {
}

void _setupBackground() {
final backgroundLayer = level.tileMap.getLayer("Background");

if (backgroundLayer != null) {
final backgroundColor =
backgroundLayer.properties.getValue("BackgroundColor") ?? 'Gray';
final backgroundTile =
BackgroundTile(color: backgroundColor, position: Vector2(0, 0));
add(backgroundTile);
}
// Create the background tile directly without checking for color
final backgroundTile = BackgroundTile(position: Vector2(0, 50));
add(backgroundTile);

// Add the clouds layer with different speed
final clouds =
Clouds(position: Vector2(0, 50)); // Adjust position as needed
add(clouds);
}

void _spawnObjects() {
Expand Down
3 changes: 3 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ flutter:
# - images/a_dot_ham.jpeg
- assets/tiles/
- assets/audio/
- assets/images/
- assets/images/Terrain/
- assets/images/Background/
- assets/images/Background/new_sky.png
- assets/images/Background/clouds.png
- assets/images/Main Characters/Mask Dude/
- assets/images/Main Characters/Ninja Frog/
- assets/images/Main Characters/Pink Man/
Expand Down

0 comments on commit ff7a60c

Please sign in to comment.