Skip to content

Commit

Permalink
added camera follow and locked player and camera to map edges
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Moose committed Jan 27, 2018
1 parent 9643f06 commit 004125d
Show file tree
Hide file tree
Showing 32 changed files with 111 additions and 48 deletions.
Binary file modified .vs/GGJ2018/v15/.suo
Binary file not shown.
Binary file modified .vs/GGJ2018/v15/sqlite3/storage.ide
Binary file not shown.
9 changes: 9 additions & 0 deletions Assets/Scenes.meta

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

19 changes: 18 additions & 1 deletion Assets/Main.unity → Assets/Scenes/Main.unity
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ GameObject:
- component: {fileID: 445298836}
- component: {fileID: 445298835}
- component: {fileID: 445298834}
- component: {fileID: 445298839}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
Expand Down Expand Up @@ -197,6 +198,22 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &445298839
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 445298833}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 68b8fed9c3dd1d24b8b61f180822dbb8, type: 3}
m_Name:
m_EditorClassIdentifier:
player: {fileID: 1493284664}
leftBound: -5
rightBound: 5
bottomBound: -5
topBound: 5
--- !u!1 &744105651
GameObject:
m_ObjectHideFlags: 0
Expand All @@ -208,7 +225,7 @@ GameObject:
- component: {fileID: 744105652}
m_Layer: 8
m_Name: Map
m_TagString: Untagged
m_TagString: Background
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions Assets/Scripts/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public class PlayerController: MonoBehaviour {
private void Awake()
{
rigidbody = GetComponent<Rigidbody2D>();
xMin = -12f;
xMax = 12f;
yMin = -6f;
yMax = 6f;
xMin = -11f;
xMax = 8f;
yMin = -9f;
yMax = 10f;
}

private void Update()
Expand Down
23 changes: 23 additions & 0 deletions Assets/Scripts/camerafollow.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class camerafollow : MonoBehaviour {

public Transform player;

public float leftBound;
public float rightBound;
public float bottomBound;
public float topBound;

// Update is called once per frame
void Update () {
transform.position = new Vector3(player.position.x, player.position.y, -10);

var pos = new Vector3(transform.position.x, transform.position.y, transform.position.z);
pos.x = Mathf.Clamp(pos.x, leftBound, rightBound);
pos.y = Mathf.Clamp(pos.y, bottomBound, topBound);
transform.position = pos;
}
}
12 changes: 12 additions & 0 deletions Assets/Scripts/camerafollow.cs.meta

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

File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions GGJ2018.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,10 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Assets\NPC_Movement.cs" />
<Compile Include="Assets\Scripts\camerafollow.cs" />
<Compile Include="Assets\Scripts\NPC_Movement.cs" />
<Compile Include="Assets\Scripts\PlayerController.cs" />
<Compile Include="Assets\selfdestructsneeze.cs" />
<Compile Include="Assets\Scripts\selfdestructsneeze.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="GenerateTargetFrameworkMonikerAttribute" />
Expand Down
78 changes: 39 additions & 39 deletions Library/CurrentLayout.dwlt
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ MonoBehaviour:
y: 0
width: 403
height: 580
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_MinSize: {x: 204, y: 221}
m_MaxSize: {x: 4004, y: 4021}
m_ActualView: {fileID: 17}
m_Panes:
- {fileID: 17}
Expand All @@ -67,10 +67,10 @@ MonoBehaviour:
y: 0
width: 1460
height: 580
m_MinSize: {x: 402, y: 221}
m_MaxSize: {x: 8002, y: 4021}
m_MinSize: {x: 406, y: 221}
m_MaxSize: {x: 8006, y: 4021}
vertical: 0
controlID: 32
controlID: 55
--- !u!114 &4
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -91,10 +91,10 @@ MonoBehaviour:
y: 30
width: 1920
height: 947
m_MinSize: {x: 679, y: 492}
m_MinSize: {x: 683, y: 492}
m_MaxSize: {x: 14004, y: 14042}
vertical: 0
controlID: 30
controlID: 123
--- !u!114 &5
MonoBehaviour:
m_ObjectHideFlags: 52
Expand Down Expand Up @@ -230,10 +230,10 @@ MonoBehaviour:
y: 0
width: 1460
height: 947
m_MinSize: {x: 402, y: 492}
m_MinSize: {x: 406, y: 492}
m_MaxSize: {x: 10002, y: 14042}
vertical: 1
controlID: 31
controlID: 54
--- !u!114 &11
MonoBehaviour:
m_ObjectHideFlags: 52
Expand All @@ -252,17 +252,17 @@ MonoBehaviour:
y: 0
width: 1057
height: 580
m_MinSize: {x: 200, y: 200}
m_MaxSize: {x: 4000, y: 4000}
m_ActualView: {fileID: 19}
m_MinSize: {x: 202, y: 221}
m_MaxSize: {x: 4002, y: 4021}
m_ActualView: {fileID: 18}
m_Panes:
- {fileID: 18}
- {fileID: 19}
- {fileID: 14}
- {fileID: 13}
- {fileID: 12}
m_Selected: 1
m_LastSelected: 0
m_Selected: 0
m_LastSelected: 1
--- !u!114 &12
MonoBehaviour:
m_ObjectHideFlags: 52
Expand Down Expand Up @@ -399,19 +399,19 @@ MonoBehaviour:
m_ShowAllHits: 0
m_SearchArea: 0
m_Folders:
- Assets/Sprites/Animations
- Assets/Scripts
m_ViewMode: 1
m_StartGridSize: 64
m_LastFolders:
- Assets/Sprites/Animations
- Assets/Scripts
m_LastFoldersGridSize: -1
m_LastProjectPath: C:\Unity\GGJ2018
m_IsLocked: 0
m_FolderTreeState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 802c0000
m_LastClickedID: 11392
m_ExpandedIDs: 0000000010260000182600007826000000ca9a3bffffff7f
m_SelectedIDs: 1e260000
m_LastClickedID: 9758
m_ExpandedIDs: 000000001826000022260000ca26000000ca9a3bffffff7f
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -439,7 +439,7 @@ MonoBehaviour:
scrollPos: {x: 0, y: 0}
m_SelectedIDs:
m_LastClickedID: 0
m_ExpandedIDs: 00000000102600001826000078260000
m_ExpandedIDs: 000000001826000022260000ca260000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -520,7 +520,7 @@ MonoBehaviour:
y: 92
width: 458
height: 926
m_ScrollPosition: {x: 0, y: 29.955078}
m_ScrollPosition: {x: 0, y: 0}
m_InspectorMode: 0
m_PreviewResizer:
m_CachedPref: 160
Expand Down Expand Up @@ -555,9 +555,9 @@ MonoBehaviour:
height: 559
m_TreeViewState:
scrollPos: {x: 0, y: 0}
m_SelectedIDs: 4c260000
m_LastClickedID: 9804
m_ExpandedIDs: a2f6f9ff1afcffff000000004c260000
m_SelectedIDs: 62260000
m_LastClickedID: 9826
m_ExpandedIDs: 18fcffff00000000
m_RenameOverlay:
m_UserAcceptedRename: 0
m_Name:
Expand Down Expand Up @@ -607,14 +607,14 @@ MonoBehaviour:
width: 1055
height: 559
m_SceneLighting: 1
lastFramingTime: 4910.004948067264
lastFramingTime: 519.4661632961627
m_2DMode: 1
m_isRotationLocked: 0
m_AudioPlay: 0
m_Position:
m_Target: {x: -11.090133, y: 2.4193096, z: -0.27241182}
m_Target: {x: -3.7883215, y: 1.522048, z: 42.852177}
speed: 2
m_Value: {x: -11.090133, y: 2.4193096, z: -0.27241182}
m_Value: {x: -3.7883215, y: 1.522048, z: 42.852177}
m_RenderMode: 0
m_ValidateTrueMetals: 0
m_SceneViewState:
Expand All @@ -641,14 +641,14 @@ MonoBehaviour:
speed: 2
m_Value: {x: 0, y: 0, z: 0, w: 1}
m_Size:
m_Target: 22.355337
m_Target: 25.062037
speed: 2
m_Value: 22.355337
m_Value: 25.062037
m_Ortho:
m_Target: 1
speed: 2
m_Value: 1
m_LastSceneViewRotation: {x: -0.08717229, y: 0.89959055, z: -0.21045254, w: -0.3726226}
m_LastSceneViewRotation: {x: -0.07919496, y: -0.114872284, z: 0.009187107, w: -0.99017584}
m_LastSceneViewOrtho: 0
m_ReplacementShader: {fileID: 0}
m_ReplacementString:
Expand Down Expand Up @@ -697,10 +697,10 @@ MonoBehaviour:
m_VAllowExceedBaseRangeMin: 1
m_VAllowExceedBaseRangeMax: 1
m_ScaleWithWindow: 0
m_HSlider: 1
m_VSlider: 1
m_HSlider: 0
m_VSlider: 0
m_IgnoreScrollWheelUntilClicked: 0
m_EnableMouseInput: 1
m_EnableMouseInput: 0
m_EnableSliderZoom: 0
m_UniformScale: 1
m_UpDirection: 1
Expand All @@ -710,18 +710,18 @@ MonoBehaviour:
y: 17
width: 1055
height: 542
m_Scale: {x: 1.3439162, y: 1.3439162}
m_Translation: {x: 521.04126, y: 274.243}
m_Scale: {x: 1, y: 1}
m_Translation: {x: 527.5, y: 271}
m_MarginLeft: 0
m_MarginRight: 0
m_MarginTop: 0
m_MarginBottom: 0
m_LastShownAreaInsideMargins:
serializedVersion: 2
x: -387.70367
y: -204.06259
width: 785.0192
height: 403.29895
x: -527.5
y: -271
width: 1055
height: 542
m_MinimalGUI: 1
m_defaultScale: 1
m_TargetTexture: {fileID: 0}
Expand Down
Binary file modified Library/InspectorExpandedItems.asset
Binary file not shown.
2 changes: 1 addition & 1 deletion Library/LastSceneManagerSetup.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
sceneSetups:
- path: Assets/Main.unity
- path: Assets/Scenes/Main.unity
isLoaded: 1
isActive: 1
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll
Binary file not shown.
Binary file modified Library/ScriptAssemblies/Assembly-CSharp.dll.mdb
Binary file not shown.
Binary file modified Library/assetDatabase3
Binary file not shown.
Binary file modified Library/metadata/00/00000000000000003000000000000000
Binary file not shown.
Binary file modified Library/metadata/57/5761b15c5f66ce0489f8fb65165bfd24
Binary file not shown.
Binary file modified Library/metadata/57/5761b15c5f66ce0489f8fb65165bfd24.info
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Library/metadata/7f/7f27fd1096f203d4bb56982b3c876ab9
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified Library/metadata/e5/e550e2ac2f6b5b04fb683fac9b34e3eb
Binary file not shown.
Binary file modified Library/metadata/e5/e550e2ac2f6b5b04fb683fac9b34e3eb.info
Binary file not shown.
Binary file modified Library/metadata/ee/ee5eb8d2f71c6ef4abe3c9801f341292
Binary file not shown.
Binary file modified Library/metadata/ee/ee5eb8d2f71c6ef4abe3c9801f341292.info
Binary file not shown.
3 changes: 2 additions & 1 deletion ProjectSettings/TagManager.asset
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
tags:
- Background
layers:
- Default
- TransparentFX
Expand Down

0 comments on commit 004125d

Please sign in to comment.