Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 437290f0 authored by Florent Bouchez Tichadou's avatar Florent Bouchez Tichadou
Browse files

Trying to make the teleportation into new map test work.

parent acc5b8e5
No related branches found
No related tags found
1 merge request!8Merge 04_teleportation level + Action class added
......@@ -8,11 +8,11 @@ from lib.utils import cus
class Level(AbstractLevel):
"""01_intro"""
def arcade_pre_run(self):
def arcade_custom_first_start(self):
player = self.map.player
tele = self.map.named_objects["teleport"]
entry = self.map.named_objects["entry"]
entry = self.map.coordinates["entry"]
def player_custom_update(player, *args):
cus.debug(f"Custom update with tele {tele.coord_x}x{tele.coord_y}")
......
......@@ -7,11 +7,17 @@
* exec_name: test
* engine_name: none
*
* available_commands: next step edit
*
* no_verify: must_call verify_exit
* no_verify_exit: cond player_y == exit_y
*
* arcade_maps: main test.tmx
* arcade_maps: tele test2.tmx
* arcade_maps: tele_offset 100 0
*
* OBJteleport:
* OBJentry:
* coordinates: entry
**/
#include <stdlib.h>
#include <stdio.h>
......@@ -21,17 +27,18 @@
* player_y: 2
*
* Map goal
* exit_x: 9
* exit_y: 4
*
*/
int player_x = 4;
int exit_x = 9;
int exit_x = 109;
int tele_x = 7;
void forward(void)
{
player_x = player_x + 1;
if (player_x == tele_x) player_x = exit_x-2;
}
int main(void)
......
......@@ -38,7 +38,7 @@ class SpCoordinates:
self.prev_center_x: float = self.center_x
self.prev_center_y: float = self.center_y
def set_amap(self, amap):
def set_amap(self, amap: Amap):
self.amap = amap
def set_relative_position(self, pos_x, pos_y):
......
......@@ -448,6 +448,13 @@ class GameView(EmptyView):
log.debug(f"Offset of map: {map_off_x}x{map_off_y}")
objects = {}
# TODO EXIT REMOVE THIS LATER
if map_name == "tele":
# remove exit from main map
print("DO STUFF WITH EXIT AND TELE LEVEL")
# del self.level_maps["main"]["objects"]["exit"]
objects["exit"] = self.exit
if 'objects' not in tm.sprite_lists:
# create emtpy list
tm.sprite_lists['objects'] = arcade.SpriteList()
......
......@@ -49,8 +49,8 @@ class LevelArcade(AbstractLevel, Thread):
lvl.debug("Sprite objects: None")
else:
lvl.debug("Sprite objects:")
for sp in sp_objects.values():
lvl.debug(f" {sp}")
for sp in sp_objects:
lvl.debug(f" {sp}: {sp_objects[sp]}")
# Connect the objects to the arcade UI
for obj in self.map.named_objects.values():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment