Commit b98e7527 authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

player learning to swing in tutorial

parent 09f60372
......@@ -227,7 +227,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_RootOrder
value: 13
value: 14
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.x
......@@ -325,8 +325,89 @@ Transform:
m_Children:
- {fileID: 1847336565}
m_Father: {fileID: 0}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &221388836
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1999531773516422, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 221388837}
- component: {fileID: 221388839}
- component: {fileID: 221388838}
m_Layer: 5
m_Name: Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &221388837
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224742012649364082, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 221388836}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 3.0098, y: 3.0098, z: 3.0098}
m_Children:
- {fileID: 1814485781}
- {fileID: 1476889501}
m_Father: {fileID: 1110322468}
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: -6.94, y: 117}
m_SizeDelta: {x: -69.70001, y: -220.5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &221388838
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114983588390535474, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 221388836}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 30
m_FontStyle: 1
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 7
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: Use A and D to swing
--- !u!222 &221388839
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 222286130475247290, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 221388836}
m_CullTransparentMesh: 0
--- !u!1 &249715418
GameObject:
m_ObjectHideFlags: 0
......@@ -479,7 +560,7 @@ Transform:
- {fileID: 1133748858}
- {fileID: 1531052202}
m_Father: {fileID: 0}
m_RootOrder: 11
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &439704337
MonoBehaviour:
......@@ -1166,7 +1247,7 @@ Transform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &847592696
MonoBehaviour:
......@@ -1185,6 +1266,8 @@ MonoBehaviour:
John: {fileID: 439704334}
speech: {fileID: 439704337}
button: {fileID: 1207322006}
SwingText: {fileID: 1110322467}
player: {fileID: 0}
--- !u!1 &848583036
GameObject:
m_ObjectHideFlags: 0
......@@ -1617,6 +1700,120 @@ Prefab:
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a6dd0ddad611645efbc5ef92c67041a7, type: 2}
m_IsPrefabAsset: 0
--- !u!1 &1110322467
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1532389646548492, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1110322468}
- component: {fileID: 1110322472}
- component: {fileID: 1110322471}
- component: {fileID: 1110322470}
- component: {fileID: 1110322469}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1110322468
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224304718089781694, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1110322467}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.010000007, y: 0.010000007, z: 1}
m_Children:
- {fileID: 221388837}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 7.6234155, y: 25.006039}
m_SizeDelta: {x: 400, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1110322469
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114430094776694032, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1110322467}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e974c821358a54736b845863bbbaef8b, type: 3}
m_Name:
m_EditorClassIdentifier:
character: {fileID: 1858953467}
isCamera: 0
--- !u!114 &1110322470
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114217342922327242, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1110322467}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1110322471
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114860963424747038, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1110322467}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &1110322472
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 223320793530302588, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1110322467}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: -1020251125
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1133748857
GameObject:
m_ObjectHideFlags: 0
......@@ -2004,7 +2201,7 @@ RectTransform:
- {fileID: 1482713995}
- {fileID: 758433179}
m_Father: {fileID: 0}
m_RootOrder: 9
m_RootOrder: 10
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
......@@ -2142,7 +2339,7 @@ Prefab:
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_RootOrder
value: 12
value: 13
objectReference: {fileID: 0}
- target: {fileID: 4984355063605358, guid: cfb62dab04de2fe4da7137a2f627086b, type: 2}
propertyPath: m_LocalScale.x
......@@ -2272,6 +2469,122 @@ SpriteRenderer:
m_WasSpriteAssigned: 1
m_MaskInteraction: 0
m_SpriteSortPoint: 0
--- !u!1 &1476889500
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1142052670255770, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1476889501}
- component: {fileID: 1476889504}
- component: {fileID: 1476889503}
- component: {fileID: 1476889502}
m_Layer: 5
m_Name: InteractButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1476889501
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224018282793070894, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476889500}
m_LocalRotation: {x: -0, y: -0, z: 0.7071068, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 221388837}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 90}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -191.45, y: -23.2}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1476889502
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114816900526660398, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476889500}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, 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_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_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1476889503}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1476889503
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114368199130414440, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476889500}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 9731ee7c67f86481aab7cece5317c667, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1476889504
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 222844216497792210, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1476889500}
m_CullTransparentMesh: 0
--- !u!1 &1482713994
GameObject:
m_ObjectHideFlags: 0
......@@ -2680,8 +2993,124 @@ Transform:
m_LocalScale: {x: 20, y: 300, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1814485780
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 1142052670255770, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1814485781}
- component: {fileID: 1814485784}
- component: {fileID: 1814485783}
- component: {fileID: 1814485782}
m_Layer: 5
m_Name: InteractButton
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1814485781
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 224018282793070894, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1814485780}
m_LocalRotation: {x: 0, y: -0, z: 0.7071068, w: -0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 221388837}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 270}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 189.4, y: -23.199993}
m_SizeDelta: {x: 60, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1814485782
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114816900526660398, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1814485780}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1392445389, guid: f70555f144d8491a825f0804e09c671c, 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_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_DisabledSprite: {fileID: 0}
m_AnimationTriggers:
m_NormalTrigger: Normal
m_HighlightedTrigger: Highlighted
m_PressedTrigger: Pressed
m_DisabledTrigger: Disabled
m_Interactable: 1
m_TargetGraphic: {fileID: 1814485783}
m_OnClick:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.Button+ButtonClickedEvent, UnityEngine.UI, Version=1.0.0.0,
Culture=neutral, PublicKeyToken=null
--- !u!114 &1814485783
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 114368199130414440, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1814485780}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0, g: 0, b: 0, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 21300000, guid: 9731ee7c67f86481aab7cece5317c667, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &1814485784
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 222844216497792210, guid: 2c7917ac87eca42679b31ab33e2eec29,
type: 2}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1814485780}
m_CullTransparentMesh: 0
--- !u!1 &1817158840
GameObject:
m_ObjectHideFlags: 0
......@@ -2710,7 +3139,7 @@ Transform:
- {fileID: 906334283}
- {fileID: 662604411}
m_Father: {fileID: 0}
m_RootOrder: 10
m_RootOrder: 11
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1847336564
GameObject:
......@@ -2865,7 +3294,7 @@ Transform:
- {fileID: 1649125479}
- {fileID: 794508415}
m_Father: {fileID: 0}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2061639490
GameObject:
......@@ -3061,14 +3490,14 @@ Transform:
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2089978956}
m_LocalRotation: {x: -0, y: -0, z: -0.5695378, w: 0.8219652}
m_LocalPosition: {x: 6.87, y: 22.63, z: 0}
m_LocalPosition: {x: 6.87, y: 22.66, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1858953468}
- {fileID: 95257390}
- {fileID: 859786666}
m_Father: {fileID: 0}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -69.436005}
--- !u!70 &2089978961
CapsuleCollider2D:
......
......@@ -11,13 +11,22 @@ public class TrapezeTutorial : MonoBehaviour {
public GameObject John;
public JohnSmithSpeech speech;
public Button button;
public GameObject SwingText;
public GameObject player;
private float initialAngularDrag;
private float initialSwingForce;
private int state;
private void Start() {
player = GameObject.FindWithTag("Player");
initialAngularDrag = player.GetComponent<Rigidbody2D>().angularDrag;
initialSwingForce = player.GetComponent<TrapezePerson>().swingForce;
GameManager.SimonTutorial = true;
dialogueBox.SetActive(false);
SwingText.SetActive(false);
speech.GreetingMessage();
JohnText.text = speech.converse();
StartCoroutine(noticePlayer());
......@@ -46,14 +55,22 @@ public class TrapezeTutorial : MonoBehaviour {
void progress() {
state++;
if (state == 2) {
//learn to swing
SwingText.SetActive(true);
player.GetComponent<Rigidbody2D>().angularDrag = 10;
player.GetComponent<TrapezePerson>().swingForce *= 4;
//ensure they reach a certain angle before allowing them to progress
} else if (state == 3) {
//press space