aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 19:32:25 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-10 19:32:25 +0100
commitc17a1ac94186a2de6ad30e9228a031fb08434e52 (patch)
tree49ef4c95b4e9657cdb3b35cadae375a91a19313d
parente0054137a49927dc619ca1a94ca543ae01713e3c (diff)
tiny adjustments for preview scene
-rw-r--r--game/PreviewScene.cpp2
-rw-r--r--game/preview/NpcSubScene.cpp2
-rw-r--r--game/preview/PrevPlayerScript.cpp18
-rw-r--r--game/preview/PrevPlayerSubScene.cpp4
4 files changed, 10 insertions, 16 deletions
diff --git a/game/PreviewScene.cpp b/game/PreviewScene.cpp
index ae43225..1179ffc 100644
--- a/game/PreviewScene.cpp
+++ b/game/PreviewScene.cpp
@@ -81,7 +81,7 @@ void PreviewScene::load_scene() {
GameObject world = this->new_object("world", "TAG", vec2 {0, 0}, 0, 1);
world.add_component<Rigidbody>(Rigidbody::Data {
.body_type = Rigidbody::BodyType::STATIC,
- .collision_layer = COLL_LAY_BOT_TOP,
+ .collision_layer = 100,
});
world.add_component<BoxCollider>(vec2(100,INFINITY), vec2(VIEWPORT_X,VIEWPORT_Y));
diff --git a/game/preview/NpcSubScene.cpp b/game/preview/NpcSubScene.cpp
index a3781af..c9ab5b6 100644
--- a/game/preview/NpcSubScene.cpp
+++ b/game/preview/NpcSubScene.cpp
@@ -57,7 +57,7 @@ NpcSubScene::NpcSubScene(Scene & scn) {
.body_type = Rigidbody::BodyType::DYNAMIC,
.linear_velocity = {-50, 0},
//.max_linear_velocity = 40,
- .collision_layers = {COLL_LAY_BOT_TOP, COLL_LAY_PLAYER},
+ .collision_layers = {COLL_LAY_BOT_TOP, COLL_LAY_PLAYER, 100},
.collision_layer = COLL_LAY_PLAYER,
});
diff --git a/game/preview/PrevPlayerScript.cpp b/game/preview/PrevPlayerScript.cpp
index 2657b8d..3e6eed4 100644
--- a/game/preview/PrevPlayerScript.cpp
+++ b/game/preview/PrevPlayerScript.cpp
@@ -1,12 +1,11 @@
#include "PrevPlayerScript.h"
#include "../missile/SpawnEvent.h"
-#include "api/Transform.h"
+
+#include <crepe/api/Transform.h>
#include <crepe/api/AudioSource.h>
#include <crepe/api/Camera.h>
#include <crepe/manager/SaveManager.h>
-#include <iostream>
-#include <ostream>
using namespace crepe;
@@ -59,16 +58,16 @@ bool PrevPlayerScript::key_pressed(const KeyPressEvent & ev) {
this->head_anim->set_anim(7);
break;
case Keycode::LEFT:
- this->head->data.angle_offset -= 1;
+ this->get_component<Transform>().rotation += 10;
break;
case Keycode::RIGHT:
- this->head->data.angle_offset += 1;
+ this->get_component<Transform>().rotation -= 10;
break;
case Keycode::UP:
- this->head->data.scale_offset += 0.1;
+ this->head->data.position_offset += 10;
break;
case Keycode::DOWN:
- this->head->data.scale_offset -= 0.1;
+ this->head->data.position_offset -= 10;
break;
case Keycode::P:
this->get_component<AudioSource>().play();
@@ -98,11 +97,6 @@ bool PrevPlayerScript::key_pressed(const KeyPressEvent & ev) {
case Keycode::M:
trigger_event<MissileSpawnEvent>(MissileSpawnEvent {});
break;
- //todo
- case Keycode::PAGE_UP:
- case Keycode::PAGE_DOWN:
- case Keycode::HOME:
- break;
default:
break;
}
diff --git a/game/preview/PrevPlayerSubScene.cpp b/game/preview/PrevPlayerSubScene.cpp
index 4351deb..3f5a5d5 100644
--- a/game/preview/PrevPlayerSubScene.cpp
+++ b/game/preview/PrevPlayerSubScene.cpp
@@ -71,10 +71,10 @@ PrevPlayerSubScene::PrevPlayerSubScene(Scene & scn) {
}
);
player.add_component<Rigidbody>(Rigidbody::Data {
- .gravity_scale = 20,
+ .gravity_scale = 1,
.body_type = Rigidbody::BodyType::DYNAMIC,
.linear_velocity = vec2(100, 0),
- .collision_layers = {COLL_LAY_BOT_TOP},
+ .collision_layers = {COLL_LAY_BOT_TOP, 100},
.collision_layer = COLL_LAY_PLAYER,
});
player.add_component<BoxCollider>(vec2(50, 50));