Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Sugar Push
Added some health, score and stuff like that.
  • Loading branch information
aps16104 committed Feb 19, 2020
1 parent fb430ba commit fc0ac69
Show file tree
Hide file tree
Showing 14 changed files with 514 additions and 52 deletions.
368 changes: 357 additions & 11 deletions SpaceShooter/Assets/Main.unity

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion SpaceShooter/Assets/Prefabs/Asteroid.prefab
Expand Up @@ -145,7 +145,7 @@ CircleCollider2D:
m_Enabled: 1
m_Density: 1
m_Material: {fileID: 0}
m_IsTrigger: 0
m_IsTrigger: 1
m_UsedByEffector: 0
m_UsedByComposite: 0
m_Offset: {x: -0.021292627, y: -0.014195174}
Expand Down
6 changes: 3 additions & 3 deletions SpaceShooter/Assets/Prefabs/Bolt.prefab
Expand Up @@ -14,7 +14,7 @@ GameObject:
- component: {fileID: 1073888857780383466}
m_Layer: 0
m_Name: Bolt
m_TagString: Untagged
m_TagString: Shot
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand All @@ -27,7 +27,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2786470009650213004}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.25, y: 0.75, z: 1}
m_Children:
- {fileID: 5826147667051634208}
Expand All @@ -42,7 +42,7 @@ Rigidbody2D:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2786470009650213004}
m_BodyType: 1
m_BodyType: 0
m_Simulated: 1
m_UseFullKinematicContacts: 1
m_UseAutoMass: 0
Expand Down
22 changes: 20 additions & 2 deletions SpaceShooter/Assets/Scripts/DestroyByContact.cs
Expand Up @@ -10,7 +10,25 @@ public class DestroyByContact : MonoBehaviour
{
return;
}
Destroy(other.gameObject);
Destroy(gameObject);
if (other.tag == "Ship")
{
HealthScript.healthValue = HealthScript.healthValue - 25;
other.gameObject.SetActive(true);
Destroy(gameObject);

if (HealthScript.healthValue < 1)
{
other.gameObject.SetActive(false);
}
}

if (other.tag == "Shot")
{
ScoreScript.scoreValue += 1;
Destroy(other.gameObject);
Destroy(gameObject);
}


}
}
26 changes: 26 additions & 0 deletions SpaceShooter/Assets/Scripts/HealthScript.cs
@@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class HealthScript : MonoBehaviour
{

public static int healthValue = 100;
Text health;
void Start()
{
health = GetComponent<Text>();
}

// Update is called once per frame
void Update()
{
health.text = "Health:" + healthValue;
if (healthValue <= 1)
{
Time.timeScale = 0;
health.text = "Game Over";
}
}
}
11 changes: 11 additions & 0 deletions SpaceShooter/Assets/Scripts/HealthScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion SpaceShooter/Assets/Scripts/PlayerController.cs
Expand Up @@ -9,6 +9,8 @@ public class Boundary
{
public float xMin, xMax, yMin, yMax;
}


public class PlayerController : MonoBehaviour
{
public float speed;
Expand All @@ -22,7 +24,8 @@ public class PlayerController : MonoBehaviour

public Text score;

void Update()

void Update()
{
if (Input.GetKeyDown("space") && Time.time > nextFire)
{
Expand Down
22 changes: 22 additions & 0 deletions SpaceShooter/Assets/Scripts/ScoreScript.cs
@@ -0,0 +1,22 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;


public class ScoreScript : MonoBehaviour
{

public static int scoreValue = 0;
Text score;
void Start()
{
score = GetComponent<Text>();
}

// Update is called once per frame
void Update()
{
score.text = "Score: " + scoreValue;
}
}
11 changes: 11 additions & 0 deletions SpaceShooter/Assets/Scripts/ScoreScript.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified SpaceShooter/Builds/Build/Builds.data.unityweb
Binary file not shown.
Binary file modified SpaceShooter/Builds/Build/Builds.wasm.code.unityweb
Binary file not shown.
52 changes: 26 additions & 26 deletions SpaceShooter/Builds/Build/Builds.wasm.framework.unityweb
Expand Up @@ -1246,7 +1246,7 @@ function _emscripten_asm_const_id(code, a0) {
return ASM_CONSTS[code](a0);
}
STATIC_BASE = GLOBAL_BASE;
STATICTOP = STATIC_BASE + 3063392;
STATICTOP = STATIC_BASE + 3066976;
__ATINIT__.push({
func: (function() {
__GLOBAL__sub_I_AccessibilityScriptingClasses_cpp();
Expand Down Expand Up @@ -3021,7 +3021,7 @@ __ATINIT__.push({
})
}, {
func: (function() {
__GLOBAL__sub_I_Thread_cpp_85253();
__GLOBAL__sub_I_Thread_cpp_39566();
})
}, {
func: (function() {
Expand Down Expand Up @@ -3057,19 +3057,15 @@ __ATINIT__.push({
})
}, {
func: (function() {
__GLOBAL__sub_I_Assembly_cpp_85996();
__GLOBAL__sub_I_Assembly_cpp_40309();
})
}, {
func: (function() {
__GLOBAL__sub_I_MemoryMappedFile_cpp();
})
}, {
func: (function() {
__GLOBAL__sub_I_Runtime_cpp_86615();
})
}, {
func: (function() {
__GLOBAL__sub_I_Il2CppCodeRegistration_cpp();
__GLOBAL__sub_I_Runtime_cpp_40928();
})
}, {
func: (function() {
Expand All @@ -3087,8 +3083,12 @@ __ATINIT__.push({
func: (function() {
__GLOBAL__sub_I_Path_cpp();
})
}, {
func: (function() {
__GLOBAL__sub_I_Il2CppCodeRegistration_cpp();
})
});
var STATIC_BUMP = 3063392;
var STATIC_BUMP = 3066976;
Module["STATIC_BASE"] = STATIC_BASE;
Module["STATIC_BUMP"] = STATIC_BUMP;
var tempDoublePtr = STATICTOP;
Expand Down Expand Up @@ -16673,8 +16673,8 @@ function nullFunc_vjji(x) {
Module["printErr"]("Build with ASSERTIONS=2 for more info.");
abort(x);
}
Module["wasmTableSize"] = 62076;
Module["wasmMaxTableSize"] = 62076;
Module["wasmTableSize"] = 62079;
Module["wasmMaxTableSize"] = 62079;
function invoke_dddi(index, a1, a2, a3) {
try {
return Module["dynCall_dddi"](index, a1, a2, a3);
Expand Down Expand Up @@ -19508,11 +19508,11 @@ asm["__GLOBAL__sub_I_Assembly_cpp"] = (function() {
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Assembly_cpp.apply(null, arguments);
});
var real___GLOBAL__sub_I_Assembly_cpp_85996 = asm["__GLOBAL__sub_I_Assembly_cpp_85996"];
asm["__GLOBAL__sub_I_Assembly_cpp_85996"] = (function() {
var real___GLOBAL__sub_I_Assembly_cpp_40309 = asm["__GLOBAL__sub_I_Assembly_cpp_40309"];
asm["__GLOBAL__sub_I_Assembly_cpp_40309"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Assembly_cpp_85996.apply(null, arguments);
return real___GLOBAL__sub_I_Assembly_cpp_40309.apply(null, arguments);
});
var real___GLOBAL__sub_I_AssetBundleFileSystem_cpp = asm["__GLOBAL__sub_I_AssetBundleFileSystem_cpp"];
asm["__GLOBAL__sub_I_AssetBundleFileSystem_cpp"] = (function() {
Expand Down Expand Up @@ -20912,11 +20912,11 @@ asm["__GLOBAL__sub_I_Runtime_cpp"] = (function() {
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Runtime_cpp.apply(null, arguments);
});
var real___GLOBAL__sub_I_Runtime_cpp_86615 = asm["__GLOBAL__sub_I_Runtime_cpp_86615"];
asm["__GLOBAL__sub_I_Runtime_cpp_86615"] = (function() {
var real___GLOBAL__sub_I_Runtime_cpp_40928 = asm["__GLOBAL__sub_I_Runtime_cpp_40928"];
asm["__GLOBAL__sub_I_Runtime_cpp_40928"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Runtime_cpp_86615.apply(null, arguments);
return real___GLOBAL__sub_I_Runtime_cpp_40928.apply(null, arguments);
});
var real___GLOBAL__sub_I_Shader_cpp = asm["__GLOBAL__sub_I_Shader_cpp"];
asm["__GLOBAL__sub_I_Shader_cpp"] = (function() {
Expand Down Expand Up @@ -21032,11 +21032,11 @@ asm["__GLOBAL__sub_I_Thread_cpp"] = (function() {
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Thread_cpp.apply(null, arguments);
});
var real___GLOBAL__sub_I_Thread_cpp_85253 = asm["__GLOBAL__sub_I_Thread_cpp_85253"];
asm["__GLOBAL__sub_I_Thread_cpp_85253"] = (function() {
var real___GLOBAL__sub_I_Thread_cpp_39566 = asm["__GLOBAL__sub_I_Thread_cpp_39566"];
asm["__GLOBAL__sub_I_Thread_cpp_39566"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return real___GLOBAL__sub_I_Thread_cpp_85253.apply(null, arguments);
return real___GLOBAL__sub_I_Thread_cpp_39566.apply(null, arguments);
});
var real___GLOBAL__sub_I_TilemapScriptingClasses_cpp = asm["__GLOBAL__sub_I_TilemapScriptingClasses_cpp"];
asm["__GLOBAL__sub_I_TilemapScriptingClasses_cpp"] = (function() {
Expand Down Expand Up @@ -22478,10 +22478,10 @@ var __GLOBAL__sub_I_Assembly_cpp = Module["__GLOBAL__sub_I_Assembly_cpp"] = (fun
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Assembly_cpp"].apply(null, arguments);
});
var __GLOBAL__sub_I_Assembly_cpp_85996 = Module["__GLOBAL__sub_I_Assembly_cpp_85996"] = (function() {
var __GLOBAL__sub_I_Assembly_cpp_40309 = Module["__GLOBAL__sub_I_Assembly_cpp_40309"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Assembly_cpp_85996"].apply(null, arguments);
return Module["asm"]["__GLOBAL__sub_I_Assembly_cpp_40309"].apply(null, arguments);
});
var __GLOBAL__sub_I_AssetBundleFileSystem_cpp = Module["__GLOBAL__sub_I_AssetBundleFileSystem_cpp"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
Expand Down Expand Up @@ -23648,10 +23648,10 @@ var __GLOBAL__sub_I_Runtime_cpp = Module["__GLOBAL__sub_I_Runtime_cpp"] = (funct
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Runtime_cpp"].apply(null, arguments);
});
var __GLOBAL__sub_I_Runtime_cpp_86615 = Module["__GLOBAL__sub_I_Runtime_cpp_86615"] = (function() {
var __GLOBAL__sub_I_Runtime_cpp_40928 = Module["__GLOBAL__sub_I_Runtime_cpp_40928"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Runtime_cpp_86615"].apply(null, arguments);
return Module["asm"]["__GLOBAL__sub_I_Runtime_cpp_40928"].apply(null, arguments);
});
var __GLOBAL__sub_I_Shader_cpp = Module["__GLOBAL__sub_I_Shader_cpp"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
Expand Down Expand Up @@ -23748,10 +23748,10 @@ var __GLOBAL__sub_I_Thread_cpp = Module["__GLOBAL__sub_I_Thread_cpp"] = (functio
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Thread_cpp"].apply(null, arguments);
});
var __GLOBAL__sub_I_Thread_cpp_85253 = Module["__GLOBAL__sub_I_Thread_cpp_85253"] = (function() {
var __GLOBAL__sub_I_Thread_cpp_39566 = Module["__GLOBAL__sub_I_Thread_cpp_39566"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
assert(!runtimeExited, "the runtime was exited (use NO_EXIT_RUNTIME to keep it alive after main() exits)");
return Module["asm"]["__GLOBAL__sub_I_Thread_cpp_85253"].apply(null, arguments);
return Module["asm"]["__GLOBAL__sub_I_Thread_cpp_39566"].apply(null, arguments);
});
var __GLOBAL__sub_I_TilemapScriptingClasses_cpp = Module["__GLOBAL__sub_I_TilemapScriptingClasses_cpp"] = (function() {
assert(runtimeInitialized, "you need to wait for the runtime to be ready (e.g. wait for main() to be called)");
Expand Down
3 changes: 3 additions & 0 deletions SpaceShooter/ProjectSettings/TagManager.asset
Expand Up @@ -5,6 +5,9 @@ TagManager:
serializedVersion: 2
tags:
- Shot
- Asteroid
- Boundary
- Ship
layers:
- Default
- TransparentFX
Expand Down

0 comments on commit fc0ac69

Please sign in to comment.