Added dynamically loading and gitignore

This commit is contained in:
Eljakim Herrewijnen 2021-04-25 12:36:01 +02:00
parent fccf163a4a
commit 9163506487
8 changed files with 1154 additions and 19 deletions

View File

@ -3,11 +3,11 @@ extends KinematicBody2D
const GRAVITY = 0.0 const GRAVITY = 0.0
const WALK_SPEED = 200 const WALK_SPEED = 200
const interaction_circle_size = 150 const interaction_circle_size = 150
onready var background_map = get_node("/root/Map1/background") onready var background_map = get_node("/root/base_scene/background")
onready var player = get_node("/root/Map1/Player") onready var player = get_node("/root/base_scene/Player")
onready var cell_size = background_map._get_cell_size() onready var cell_size = background_map._get_cell_size()
onready var plants_map = get_node("/root/Map1/interaction_map") onready var plants_map = get_node("/root/base_scene/interaction_map")
onready var interaction = get_node("/root/Map1/player_interaction") onready var interaction = get_node("/root/base_scene/player_interaction")
var velocity = Vector2() var velocity = Vector2()
var world_position var world_position

View File

@ -4,16 +4,15 @@ func _ready():
pass # Replace with function body. pass # Replace with function body.
func _on_Btn_PlayGame_pressed(): func _on_Btn_PlayGame_pressed():
Global.LoadSave() # Global.LoadSave()
Global.GoToScene("river_intersection_home_2") # Global.GoToScene("river_intersection_home_2")
return
Global.LoadSave() Global.LoadSave()
var game_data = GlobalStructures.base_tilemap.new() var game_data = GlobalStructures.base_tilemap.new()
var map_data = [[]] var map_data = [[]]
for x in range(150): for x in range(150):
map_data.append([]) map_data.append([])
for y in range(150): for y in range(150):
map_data[x].append(int(rand_range(0, 6))) map_data[x].append(int(rand_range(0, 77)))
game_data.init_map(150, 150, "res://omgeving/Floor.tres",map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data) game_data.init_map(150, 150, "res://omgeving/Floor.tres",map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data, "res://omgeving/Floor.tres", map_data)
var game = load("res://base_tilemap/base_tilemap.tscn").instance() var game = load("res://base_tilemap/base_tilemap.tscn").instance()
game.load_scene(game_data) game.load_scene(game_data)

View File

@ -1,8 +1,8 @@
extends Camera2D extends Camera2D
onready var player = get_node("/root/Map1/Player") onready var player = get_node("/root/base_scene/Player")
onready var background_map = get_node("/root/Map1/background") onready var background_map = get_node("/root/base_scene/background")
onready var screen_size = self.get_viewport_rect().size onready var screen_size = self.get_viewport_rect().size
func _ready(): func _ready():

View File

@ -1,8 +1,9 @@
extends TileMap extends TileMap
onready var player = get_node("/root/Map1/Player") onready var player = get_node("/root/base_scene/Player")
func _ready(): func _ready():
print(self.tile_set.get_tiles_ids())
pass # Replace with function body. pass # Replace with function body.
func _get_cell_size(): func _get_cell_size():

View File

@ -1,16 +1,20 @@
extends Node2D extends Node2D
func load_scene(map_data): func load_scene(map_data):
var imageset = load("res://omgeving/Floor.tres") # var imageset = load("res://omgeving/Floor.tres")
$background.tile_set = imageset $background.tile_set = load("base_tilemap/tilesets/background_ts.tres")
$background.tile_set.autotile_set_size(1, $background.tile_set.autotile_get_size(0))
$background.tile_set.autotile_set_size(2, $background.tile_set.autotile_get_size(0))
$background.tile_set.autotile_set_size(3, $background.tile_set.autotile_get_size(0))
var k = $background
$vegetation.tile_set = load("res://river_intersection_home2.tscn::1")
# $vegetation.tile_set = preload("res://omgeving/Floor.tres")
for x in range(map_data.width): for x in range(map_data.width):
for y in range(map_data.height): for y in range(map_data.height):
$background.set_cell(x, y, map_data.background_map[x][y]) $background.set_cell(x, y, map_data.background_map[x][y])
$vegetation.set_cell(x, y, map_data.background_map[x][y]) $vegetation.set_cell(x, y, 0)
$interaction_map.set_cell(x, y, map_data.background_map[x][y]) $interaction_map.set_cell(x, y, -1)
$player_interaction.set_cell(x, y, 0) $player_interaction.set_cell(x, y, -1)
if(1==1):
pass
func _ready(): func _ready():
pass # Replace with function body. pass # Replace with function body.

Binary file not shown.

After

Width:  |  Height:  |  Size: 121 KiB

View File

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/background_ts.png-a5363f63cd6ab350fb8a575c008fe06e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://base_tilemap/tilesets/background_ts.png"
dest_files=[ "res://.import/background_ts.png-a5363f63cd6ab350fb8a575c008fe06e.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=false
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

File diff suppressed because it is too large Load Diff