5 Commits

Author SHA1 Message Date
ProtoSharkk
26f8a323d3 Merge pull request #11 from ProtoSharkk/dash
Dashing into enemies creates a shockwave that pushes them away
2024-10-28 17:47:09 -07:00
7b15dbb593 Dashing into enemies creates a shockwave that pushes them away
You don't take damage from this
2024-10-27 21:27:38 -07:00
ProtoSharkk
bd1090aabe Merge pull request #10 from ProtoSharkk/variants
Gun thrower ratbots
2024-10-27 19:19:14 -07:00
Iazubi
1e878b2b67 Update README.md 2024-10-27 02:05:58 -07:00
Iazubi
8f970dfbc2 Update README.md 2024-10-27 02:01:45 -07:00
11 changed files with 74 additions and 271 deletions

View File

@@ -1,181 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &7192111562784377269
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7306069853192956541}
- component: {fileID: 6956675740950355391}
- component: {fileID: 3724765237708177526}
- component: {fileID: 8790759452092966400}
- component: {fileID: 6076434776385846704}
m_Layer: 0
m_Name: FastFucker
m_TagString: Ratbot
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7306069853192956541
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7192111562784377269}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.45, y: 0.45, z: 0.45}
m_ConstrainProportionsScale: 1
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!212 &6956675740950355391
SpriteRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7192111562784377269}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RayTracingAccelStructBuildFlagsOverride: 0
m_RayTracingAccelStructBuildFlags: 1
m_SmallMeshCulling: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: a97c105638bdf8b4a8650670310a4cd3, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 0
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 1
m_Sprite: {fileID: -3751497128136096670, guid: 520c934c186517356929c5948597af6f, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_FlipX: 0
m_FlipY: 0
m_DrawMode: 0
m_Size: {x: 5.12, y: 5.12}
m_AdaptiveModeThreshold: 0.5
m_SpriteTileMode: 0
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!114 &3724765237708177526
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7192111562784377269}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 07603fdf7ab38f05493e2a22ef5cae06, type: 3}
m_Name:
m_EditorClassIdentifier:
moveSpeed: 1500
damageStrength: 10
damageTimeoutSeconds: 0.5
health: 10
--- !u!61 &8790759452092966400
BoxCollider2D:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7192111562784377269}
m_Enabled: 1
serializedVersion: 3
m_Density: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_LayerOverridePriority: 0
m_ForceSendLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ForceReceiveLayers:
serializedVersion: 2
m_Bits: 4294967295
m_ContactCaptureLayers:
serializedVersion: 2
m_Bits: 4294967295
m_CallbackLayers:
serializedVersion: 2
m_Bits: 4294967295
m_IsTrigger: 0
m_UsedByEffector: 0
m_CompositeOperation: 0
m_CompositeOrder: 0
m_Offset: {x: 0, y: 0}
m_SpriteTilingProperty:
border: {x: 0, y: 0, z: 0, w: 0}
pivot: {x: 0.5, y: 0.5}
oldSize: {x: 3.53, y: 4.2}
newSize: {x: 5.12, y: 5.12}
adaptiveTilingThreshold: 0.5
drawMode: 0
adaptiveTiling: 0
m_AutoTiling: 0
m_Size: {x: 3.53, y: 4.2}
m_EdgeRadius: 0
--- !u!50 &6076434776385846704
Rigidbody2D:
serializedVersion: 5
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7192111562784377269}
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 0
m_UseAutoMass: 0
m_Mass: 0.2
m_LinearDamping: 15
m_AngularDamping: 0.05
m_GravityScale: 1
m_Material: {fileID: 0}
m_IncludeLayers:
serializedVersion: 2
m_Bits: 0
m_ExcludeLayers:
serializedVersion: 2
m_Bits: 0
m_Interpolate: 0
m_SleepingMode: 1
m_CollisionDetection: 0
m_Constraints: 4

View File

@@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: 2c67a9ffe3cbdc6989fcabe398ffd2dc
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -681,10 +681,8 @@ MonoBehaviour:
m_EditorClassIdentifier: m_EditorClassIdentifier:
state: 0 state: 0
wave: 0 wave: 0
ratbot: {fileID: 398740452138961375, guid: b1e1e6378fb12d47e989565896a737ef, type: 3}
shop: {fileID: 6569104281457075541, guid: c0d23b24c9c882ef89013998dab29dea, type: 3} shop: {fileID: 6569104281457075541, guid: c0d23b24c9c882ef89013998dab29dea, type: 3}
ratbot: {fileID: 398740452138961375, guid: 5887eeeb7c78eb5c7bf46c5893fd4846, type: 3}
gunThrower: {fileID: 398740452138961375, guid: b1e1e6378fb12d47e989565896a737ef, type: 3}
fastFucker: {fileID: 7192111562784377269, guid: 2c67a9ffe3cbdc6989fcabe398ffd2dc, type: 3}
--- !u!4 &745837569 --- !u!4 &745837569
Transform: Transform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View File

@@ -7,13 +7,11 @@ public class GameState : MonoBehaviour
public GameObject shop; public GameObject shop;
public GameObject ratbot; public GameObject ratbot;
public GameObject gunThrower; public GameObject gunThrower;
public GameObject fastFucker;
int[] counts = new int[3]; int[] counts = new int[2];
enum CountIndex : uint { enum CountIndex : uint {
ratbot = 0, ratbot = 0,
gunThrower = 1, gunThrower = 1
fastFucker = 2
} }
void Start() { void Start() {
@@ -54,7 +52,6 @@ public class GameState : MonoBehaviour
for (uint _ = 0; _ <= wave; _++) { for (uint _ = 0; _ <= wave; _++) {
GameObject newRatbot = Instantiate( GameObject newRatbot = Instantiate(
SpawnRatbot(), SpawnRatbot(),
// Spawn ratbots in a circle around the player
Random.insideUnitCircle.normalized*20 Random.insideUnitCircle.normalized*20
+ new Vector2 ( + new Vector2 (
playerPosition.x, playerPosition.x,
@@ -62,8 +59,6 @@ public class GameState : MonoBehaviour
), ),
Quaternion.identity Quaternion.identity
); );
// Set ratbot damageStrength and health
// TODO: set speed
newRatbot.GetComponent<Ratbot>().damageStrength newRatbot.GetComponent<Ratbot>().damageStrength
= 5+wave*5; = 5+wave*5;
newRatbot.GetComponent<Ratbot>().health = 5+wave*2; newRatbot.GetComponent<Ratbot>().health = 5+wave*2;
@@ -71,19 +66,12 @@ public class GameState : MonoBehaviour
wave++; wave++;
} }
public GameObject SpawnRatbot() { public GameObject SpawnRatbot() {
// TODO: Convert this mess into a switch case
if (counts[(uint)CountIndex.gunThrower] < wave/3 if (counts[(uint)CountIndex.gunThrower] < wave/3
&& wave > 3 && wave > 3
) { ) {
counts[(uint)CountIndex.gunThrower]++; counts[(uint)CountIndex.gunThrower]++;
return gunThrower; return gunThrower;
} }
if (counts[(uint)CountIndex.fastFucker] < wave/4
&& wave > 2
) {
counts[(uint)CountIndex.fastFucker]++;
return fastFucker;
}
return ratbot; return ratbot;
} }
} }

View File

@@ -1,34 +0,0 @@
using UnityEngine;
using System.Collections;
public class FastFucker : Ratbot
{
bool attack = true;
void Update() {
if (attack)
MoveTowardsPlayer(moveSpeed*2);
else
MoveAwayFromPlayer(moveSpeed);
}
void MoveAwayFromPlayer(float speed) {
controller.AddRelativeForce(
(transform.position - player.transform.position)
.normalized
*speed
*Time.deltaTime
);
}
new void OnCollisionStay2D (Collision2D collision) {
base.OnCollisionStay2D(collision);
StartCoroutine("RunAway");
}
IEnumerator RunAway() {
attack = false;
yield return new WaitForSeconds (1F);
attack = true;
}
new void Damage (float hurtyAmount) {
RunAway();
base.Damage(hurtyAmount);
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: 07603fdf7ab38f05493e2a22ef5cae06

View File

@@ -10,33 +10,28 @@ public class Ratbot : MonoBehaviour
public static GameState gameState; public static GameState gameState;
public static GameObject player; public static GameObject player;
public Rigidbody2D controller;
void Start() { void Start() {
SetVars(); SetVars();
} }
public void SetVars() { public void SetVars() {
controller = GetComponent<Rigidbody2D>();
// Set gameState and player objects // Set gameState and player objects
player = GameObject.FindGameObjectWithTag("Player"); player = GameObject.FindGameObjectWithTag("Player");
gameState = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameState>(); gameState = GameObject.FindGameObjectWithTag("GameController").GetComponent<GameState>();
} }
void Update() { void Update() {
MoveTowardsPlayer(moveSpeed); MoveTowardsPlayer();
} }
public void MoveTowardsPlayer(float speed) { public void MoveTowardsPlayer() {
controller.AddRelativeForce( Rigidbody2D controller = GetComponent<Rigidbody2D>();
(player.transform.position - transform.position) Vector2 direction = (player.transform.position - transform.position).normalized;
.normalized controller.AddRelativeForce(direction*moveSpeed*Time.deltaTime);
*speed
*Time.deltaTime
);
} }
public virtual void OnCollisionStay2D(Collision2D collision) { void OnCollisionStay2D(Collision2D collision) {
// Deal damage when colliding with the player on a 0.5 second cooldown // Deal damage when colliding with the player on a 0.5 second cooldown
if (collision.gameObject.tag != "Player") return; if (collision.gameObject.tag != "Player") return;
if (lastDamageTime > Time.fixedTime-damageTimeoutSeconds) return; if (lastDamageTime > Time.fixedTime-damageTimeoutSeconds) return;
@@ -46,6 +41,7 @@ public class Ratbot : MonoBehaviour
// Die if health below zero // Die if health below zero
public void Damage(float hurtyAmount) { public void Damage(float hurtyAmount) {
Debug.Log(hurtyAmount);
health -= hurtyAmount; health -= hurtyAmount;
if (health <= 0) { if (health <= 0) {
Destroy(gameObject); Destroy(gameObject);

View File

@@ -94,9 +94,21 @@ public class Teo : MonoBehaviour
).normalized * dashDistance); ).normalized * dashDistance);
// Wait 0.2 seconds before ending the dash // Wait 0.2 seconds before ending the dash
yield return new WaitForSeconds(0.2F); yield return new WaitForSeconds(0.2F);
// Re enable collision and linearDamping after dash complete // Re enable collision and linearDamping after dash
dashing = false; dashing = false;
collider.enabled = true;
controller.linearDamping = 15; controller.linearDamping = 15;
// Push enemies away at end of dash
foreach (Collider2D hit in Physics2D.OverlapCircleAll(
transform.position, 3
)) {
if (hit.tag != "Ratbot") continue;
hit.GetComponent<Rigidbody2D>().AddRelativeForce(
(hit.transform.position - transform.position)
.normalized * dashDistance
);
}
// Don't take damage at end of dash
yield return new WaitForSeconds(0.2F);
collider.enabled = true;
} }
} }

View File

@@ -1,5 +1,43 @@
# RatStabber # RatStabber
![TeoSword_clear](https://github.com/user-attachments/assets/5cc699a3-c4a2-47c5-9d7f-10f8546ad48f)
### Fight off the ratbots and save the rat cities as the hunky man Teo himself! (and all the goofy ai generated images of him and everyone else)
## LORE:
After successfully defeating the Paulbots, the rat took components of the Paulbots and improved the design to create the rat bots. He could finally get revenge on Paul for the destruction of his kind. However, the Paul Bots managed to regain consciousness inside of the new and improved Rat Bots, making the Ratbots turn against the rat, taking his weapons and his last hopes of defeating Paul. You (Teo) have arrived to protect the rat and help him figure out a way to stop the now evil rat bots and discover the dark, hidden secrets while ending this war once and for all.
## And that's the game... I guess...
### Alright, Here's the Basic Vision: ### Alright, Here's the Basic Vision:
- The Player (Teo) moves around an infinite field with the camera following the player - The Player (Teo) moves around an infinite field with the camera following the player
@@ -39,7 +77,7 @@
- [x] Wave spawns enemies - [x] Wave spawns enemies
- [x] Detect when wave ends - [x] Detect when wave ends
- [x] Activate new waves after powerup has been chosen by player - [x] Activate new waves after powerup has been chosen by player
- [ ] Dash ability - [x] Dash ability
### Enemy: ### Enemy:
- [x] All Enemies have simple pathfinding towards the player - [x] All Enemies have simple pathfinding towards the player
@@ -60,34 +98,29 @@
### In-Game UI: ### In-Game UI:
- [x] Player health on bottom left - [x] Player health on bottom left
- [ ] Round / Wave on bottom left (?) - [x] Round / Wave on bottom left (?)
- [ ] Maybe show enemy remaining count? (We can make a hard mode that removes UI except health) - [ ] Maybe show enemy remaining count? (We can make a hard mode that removes UI except health)
- [ ] Upon round end, pop-up menu for selecting powerup - [ ] Upon round end, pop-up menu for selecting powerup
- [x] Damage - [x] Damage
- [ ] Attack distance - [x] Attack distance
- [ ] Attack range - [x] Attack range
- [ ] Attack cooldown - [x] Attack cooldown
- [x] Health - [x] Health
- [x] Speed - [x] Speed
- [ ] Dash cooldown - [x] Dash cooldown
- [ ] Dash distance - [x] Dash distance
- [ ] (Only an idea for now) Have a status bar at the bottom right to show your current stats - [ ] (Only an idea for now) Have a status bar at the bottom right to show your current stats
### UI / AUDIO: ### UI / AUDIO:
- [ ] Menu Screen - [x] Menu Screen
- [ ] Pause Screen - [ ] Pause Screen
- [ ] Option for returning to main menu / resume - [ ] Option for returning to main menu / resume
- [ ] Menu Music - [x] Menu Music
- [ ] Level Music - [x] Level Music
- [ ] A section where the player can view unlocked lore by completing more of the game - [x] A section where the player can view unlocked lore by completing more of the game
- [ ] LORE GETS UNLOCKED EVERY 10 ROUNDS BEATEN + BOSS BEATEN
## LORE:
After successfully defeating the Paul bots, the rat improved upon the design to create the rat bots. He could finally get revenge on Paul for the destruction of his kind. However, the Paul Bots managed to regain consciousness inside of the new and improved Rat Bots, in-turn making the Ratbots turn against the rat, taking his weapons and his last hopes of defeating Paul as well. You (Teo) have arrived to protect the rat and help him figure out a way to stop the now evil rat bots and put an end to this war once and for all.