commit
20cb148b83
8
Jump Game/Assets/Images.meta
Normal file
8
Jump Game/Assets/Images.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2cbe78b579dd10f478feaa932286c6e2
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
0
Jump Game/Assets/Images/.gitkeep
Normal file
0
Jump Game/Assets/Images/.gitkeep
Normal file
8
Jump Game/Assets/Prefab.meta
Normal file
8
Jump Game/Assets/Prefab.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1c796162f2184c14cbca85828bc76c4d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
218
Jump Game/Assets/Prefab/MenuButton.prefab
Normal file
218
Jump Game/Assets/Prefab/MenuButton.prefab
Normal file
@ -0,0 +1,218 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4998347822207226556
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4302189230082019122}
|
||||
- component: {fileID: 2877597085422380734}
|
||||
- component: {fileID: 824959804990448529}
|
||||
- component: {fileID: 4604532315722087914}
|
||||
- component: {fileID: 6251025272873916927}
|
||||
m_Layer: 5
|
||||
m_Name: MenuButton
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4302189230082019122
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998347822207226556}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1024415783897295074}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 200, y: 50}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &2877597085422380734
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998347822207226556}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &824959804990448529
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998347822207226556}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &4604532315722087914
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998347822207226556}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Navigation:
|
||||
m_Mode: 3
|
||||
m_SelectOnUp: {fileID: 0}
|
||||
m_SelectOnDown: {fileID: 0}
|
||||
m_SelectOnLeft: {fileID: 0}
|
||||
m_SelectOnRight: {fileID: 0}
|
||||
m_Transition: 1
|
||||
m_Colors:
|
||||
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||
m_ColorMultiplier: 1
|
||||
m_FadeDuration: 0.1
|
||||
m_SpriteState:
|
||||
m_HighlightedSprite: {fileID: 0}
|
||||
m_PressedSprite: {fileID: 0}
|
||||
m_SelectedSprite: {fileID: 0}
|
||||
m_DisabledSprite: {fileID: 0}
|
||||
m_AnimationTriggers:
|
||||
m_NormalTrigger: Normal
|
||||
m_HighlightedTrigger: Highlighted
|
||||
m_PressedTrigger: Pressed
|
||||
m_SelectedTrigger: Selected
|
||||
m_DisabledTrigger: Disabled
|
||||
m_Interactable: 1
|
||||
m_TargetGraphic: {fileID: 824959804990448529}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
--- !u!114 &6251025272873916927
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4998347822207226556}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreLayout: 0
|
||||
m_MinWidth: -1
|
||||
m_MinHeight: -1
|
||||
m_PreferredWidth: 200
|
||||
m_PreferredHeight: 50
|
||||
m_FlexibleWidth: -1
|
||||
m_FlexibleHeight: -1
|
||||
m_LayoutPriority: 1
|
||||
--- !u!1 &5540465275976261387
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1024415783897295074}
|
||||
- component: {fileID: 345880713922546936}
|
||||
- component: {fileID: 8476956362632692680}
|
||||
m_Layer: 5
|
||||
m_Name: Text
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &1024415783897295074
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5540465275976261387}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 4302189230082019122}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 1}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &345880713922546936
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5540465275976261387}
|
||||
m_CullTransparentMesh: 0
|
||||
--- !u!114 &8476956362632692680
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5540465275976261387}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_FontData:
|
||||
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_FontSize: 14
|
||||
m_FontStyle: 0
|
||||
m_BestFit: 0
|
||||
m_MinSize: 10
|
||||
m_MaxSize: 40
|
||||
m_Alignment: 4
|
||||
m_AlignByGeometry: 0
|
||||
m_RichText: 1
|
||||
m_HorizontalOverflow: 0
|
||||
m_VerticalOverflow: 0
|
||||
m_LineSpacing: 1
|
||||
m_Text: Button
|
7
Jump Game/Assets/Prefab/MenuButton.prefab.meta
Normal file
7
Jump Game/Assets/Prefab/MenuButton.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 849f48437cf3cb841a32cc7467d8a2e5
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
4253
Jump Game/Assets/Scenes/MainMenu.unity
Normal file
4253
Jump Game/Assets/Scenes/MainMenu.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Jump Game/Assets/Scenes/MainMenu.unity.meta
Normal file
7
Jump Game/Assets/Scenes/MainMenu.unity.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c55305ddfd66da140a9e0015ebacd456
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Jump Game/Assets/Scripts.meta
Normal file
8
Jump Game/Assets/Scripts.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1637c2909e7e1c94ab8428f9e55184a6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Jump Game/Assets/Scripts/Menu.meta
Normal file
8
Jump Game/Assets/Scripts/Menu.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c119224b414bbbc49b3b289ff23052aa
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
62
Jump Game/Assets/Scripts/Menu/Menu_Buttons.cs
Normal file
62
Jump Game/Assets/Scripts/Menu/Menu_Buttons.cs
Normal file
@ -0,0 +1,62 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Menu_Buttons : MonoBehaviour
|
||||
{
|
||||
public GameObject MainMenuPanel;
|
||||
public GameObject OptionMenuPanel;
|
||||
public GameObject OptionAudioPanel;
|
||||
public GameObject OptionVideoPanel;
|
||||
public GameObject OptionControlsPanel;
|
||||
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
MainMenuPanel.SetActive(true);
|
||||
OptionMenuPanel.SetActive(false);
|
||||
OptionAudioPanel.SetActive(false);
|
||||
OptionVideoPanel.SetActive(false);
|
||||
OptionControlsPanel.SetActive(false);
|
||||
}
|
||||
public void ShowMainMenuPanel()
|
||||
{
|
||||
MainMenuPanel.SetActive(true);
|
||||
OptionMenuPanel.SetActive(false);
|
||||
OptionAudioPanel.SetActive(false);
|
||||
OptionVideoPanel.SetActive(false);
|
||||
OptionControlsPanel.SetActive(false);
|
||||
}
|
||||
public void ShowOptionMenuPanel()
|
||||
{
|
||||
MainMenuPanel.SetActive(false);
|
||||
OptionMenuPanel.SetActive(true);
|
||||
OptionAudioPanel.SetActive(false);
|
||||
OptionVideoPanel.SetActive(false);
|
||||
OptionControlsPanel.SetActive(false);
|
||||
}
|
||||
public void ShowOptionAudio()
|
||||
{
|
||||
MainMenuPanel.SetActive(false);
|
||||
OptionMenuPanel.SetActive(true);
|
||||
OptionAudioPanel.SetActive(true);
|
||||
OptionVideoPanel.SetActive(false);
|
||||
OptionControlsPanel.SetActive(false);
|
||||
}
|
||||
public void ShowOptionVideo()
|
||||
{
|
||||
MainMenuPanel.SetActive(false);
|
||||
OptionMenuPanel.SetActive(true);
|
||||
OptionAudioPanel.SetActive(false);
|
||||
OptionVideoPanel.SetActive(true);
|
||||
OptionControlsPanel.SetActive(false);
|
||||
}
|
||||
public void ShowOptionControls()
|
||||
{
|
||||
MainMenuPanel.SetActive(false);
|
||||
OptionMenuPanel.SetActive(true);
|
||||
OptionAudioPanel.SetActive(false);
|
||||
OptionVideoPanel.SetActive(false);
|
||||
OptionControlsPanel.SetActive(true);
|
||||
}
|
||||
}
|
11
Jump Game/Assets/Scripts/Menu/Menu_Buttons.cs.meta
Normal file
11
Jump Game/Assets/Scripts/Menu/Menu_Buttons.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1da90b8136ceae74981c132e9525e786
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
8
Jump Game/Assets/Scripts/Player.meta
Normal file
8
Jump Game/Assets/Scripts/Player.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb39dfc7dbc98c245b8f4d3084c8251b
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
74
Jump Game/Assets/Scripts/Player/PlayerController.cs
Normal file
74
Jump Game/Assets/Scripts/Player/PlayerController.cs
Normal file
@ -0,0 +1,74 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PlayerController : MonoBehaviour
|
||||
{
|
||||
private Rigidbody2D rbody;
|
||||
private float moveInput;
|
||||
private float movementSpeed;
|
||||
private float jumpForce;
|
||||
|
||||
public bool isGrounded;
|
||||
public Transform feetPos;
|
||||
public LayerMask whatIsGround;
|
||||
public float checkRadius;
|
||||
|
||||
private float charger;
|
||||
private bool discharge;
|
||||
private bool isCharging;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rbody = GetComponent<Rigidbody2D>();
|
||||
isCharging = false;
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetKey(KeyCode.Space))
|
||||
{
|
||||
charger += Time.deltaTime;
|
||||
isCharging = true;
|
||||
}
|
||||
|
||||
if (Input.GetKeyUp(KeyCode.Space))
|
||||
{
|
||||
discharge = true;
|
||||
isCharging = false;
|
||||
}
|
||||
}
|
||||
void FixedUpdate()
|
||||
{
|
||||
isGrounded = Physics2D.OverlapCircle(feetPos.position, checkRadius, whatIsGround);
|
||||
if (isGrounded)
|
||||
{
|
||||
moveInput = Input.GetAxis("Horizontal");
|
||||
}
|
||||
rbody.velocity = new Vector2(moveInput * movementSpeed, rbody.velocity.y);
|
||||
|
||||
// Stops movement when space is pressed
|
||||
if (isCharging && isGrounded)
|
||||
{
|
||||
movementSpeed = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
movementSpeed = 8;
|
||||
}
|
||||
|
||||
if (discharge && isGrounded)
|
||||
{
|
||||
// Charges the jump
|
||||
jumpForce = 10 * charger;
|
||||
if (jumpForce > 10)
|
||||
{
|
||||
jumpForce = 10;
|
||||
}
|
||||
rbody.velocity = new Vector2(rbody.velocity.x, jumpForce);
|
||||
|
||||
// Reset charge and set discharge to false
|
||||
charger = 0f;
|
||||
discharge = false;
|
||||
}
|
||||
}
|
||||
}
|
11
Jump Game/Assets/Scripts/Player/PlayerController.cs.meta
Normal file
11
Jump Game/Assets/Scripts/Player/PlayerController.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9e14f232f0f11dc41b1adac14025f569
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user