Browse Source

fixed game

meemknight 1 year ago
parent
commit
2f7f83f7f1

+ 3 - 0
Pika/gameplay/containers/isometricGame/isometricGameEditor.h

@@ -12,6 +12,9 @@
 struct IsometricGameEditor: public Container
 struct IsometricGameEditor: public Container
 {
 {
 
 
+	//todo some decorative piece and a hint
+	//alimente care ii scresc viata
+
 	enum Blocks
 	enum Blocks
 	{
 	{
 		air = 0,
 		air = 0,

+ 1 - 0
Pika/gameplay/containers/minecraftDungeons/mcDungeonsgameplay.h

@@ -38,6 +38,7 @@ struct McDungeonsGameplay: public Container
 	{
 	{
 		glm::vec2 size = glm::vec2(0.3f, 0.3f);
 		glm::vec2 size = glm::vec2(0.3f, 0.3f);
 		glm::vec2 position = {glm::vec2(0,0)};
 		glm::vec2 position = {glm::vec2(0,0)};
+		glm::vec2 lookDirection = {0,-1};
 
 
 		glm::vec2 lastPos{};
 		glm::vec2 lastPos{};
 
 

+ 8 - 3
Pika/gameplay/containers/threeDGameExample/threeDGameExample.h

@@ -589,6 +589,7 @@ struct ThreeDGameExample: public Container
 						if (dir.x != 0 || dir.y != 0)
 						if (dir.x != 0 || dir.y != 0)
 						{
 						{
 							dir = glm::normalize(dir);
 							dir = glm::normalize(dir);
+							p.physics.lookDirection = dir;
 
 
 							p.physics.desiredRotation = std::atan2(dir.x, dir.y);
 							p.physics.desiredRotation = std::atan2(dir.x, dir.y);
 							
 							
@@ -622,7 +623,9 @@ struct ThreeDGameExample: public Container
 						float speed = 3;
 						float speed = 3;
 						p.physics.position += dir * input.deltaTime * speed;
 						p.physics.position += dir * input.deltaTime * speed;
 
 
-						if (input.buttons[pika::Button::Space].pressed() /*&& attackCulldown <= 0*/)
+						if ((!differentInput && input.buttons[pika::Button::Space].pressed()) ||
+							(differentInput && input.buttons[pika::Button::Enter].pressed())
+							)
 						{
 						{
 							//renderer.setEntityAnimationIndex(playerEntity, attack); //attack
 							//renderer.setEntityAnimationIndex(playerEntity, attack); //attack
 							//renderer.setEntityAnimationSpeed(playerEntity, 1.3);
 							//renderer.setEntityAnimationSpeed(playerEntity, 1.3);
@@ -630,7 +633,9 @@ struct ThreeDGameExample: public Container
 
 
 							for (int i = 0; i < enemies.size(); i++)
 							for (int i = 0; i < enemies.size(); i++)
 							{
 							{
-								float d = glm::distance(p.physics.position, enemies[i].physics.position);
+								float d = glm::distance(p.physics.position
+									+ p.physics.lookDirection * 4.5f
+									, enemies[i].physics.position);
 								if (d < 4.5f)
 								if (d < 4.5f)
 								{
 								{
 									enemies[i].life -= 0.4;
 									enemies[i].life -= 0.4;
@@ -847,7 +852,7 @@ struct ThreeDGameExample: public Container
 
 
 				if (!player2joined) { d2 = 10000000000; }
 				if (!player2joined) { d2 = 10000000000; }
 
 
-				if (d < 8.f || d2 < 8.f)
+				if (d < 16.f || d2 < 16.f)
 				{
 				{
 
 
 					auto attack = [&](PlayerModel &p, float d)
 					auto attack = [&](PlayerModel &p, float d)

+ 5 - 16
Pika/resources/logs.txt

@@ -1,16 +1,5 @@
-#2024-01-04 16:57:38: Created container: IsometricGameEditor
-#2024-01-04 16:59:44: Created container: IsometricGameEditor
-#2024-01-04 16:59:45: Created container: IsometricGameEditor
-#2024-01-04 16:59:47: Destroyed continer: IsometricGameEditor #3
-#2024-01-04 16:59:48: Destroyed continer: IsometricGameEditor #2
-#2024-01-04 17:00:32: Created container: IsometricGameEditor
-#2024-01-04 17:00:33: Destroyed continer: IsometricGameEditor #1
-#2024-01-04 17:01:42: Created container: IsometricGameEditor
-#2024-01-04 17:01:44: Destroyed continer: IsometricGameEditor #5
-#2024-01-04 17:02:41: Created container: IsometricGameEditor
-#2024-01-04 17:02:43: Destroyed continer: IsometricGameEditor #4
-#2024-01-04 17:03:53: Created container: IsometricGameEditor
-#2024-01-04 17:03:57: Destroyed continer: IsometricGameEditor #6
-#2024-01-04 17:05:49: Created container: IsometricGameEditor
-#2024-01-04 17:06:21: Destroyed continer: IsometricGameEditor #7
-#2024-01-04 17:07:43: Destroyed continer: IsometricGameEditor #8
+#2024-01-06 13:16:02[error]: Couldn't allocate memory for constructing container: #1
+#2024-01-06 13:16:06[error]: Couldn't allocate memory for constructing container: #2
+#2024-01-06 13:16:34: Created container: ThreeDGameExample
+#2024-01-06 13:21:37: Reloaded dll
+#2024-01-06 13:22:20: Destroyed continer: ThreeDGameExample #3