Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
SSBookMinigames
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
SSBookMinigames
Commits
c0bac770
Commit
c0bac770
authored
Feb 26, 2026
by
Mahmoud Mostafa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added touch screen movement
parent
393db714
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
McqPlayerRunner.cs
...oject/Assets/ScienceStreet/MCQ/Scripts/McqPlayerRunner.cs
+24
-0
No files found.
My project/Assets/ScienceStreet/MCQ/Scripts/McqPlayerRunner.cs
View file @
c0bac770
...
...
@@ -15,6 +15,7 @@ namespace com.al_arcade.mcq
[
SerializeField
]
private
float
laneSwitchSpeed
=
8f
;
[
SerializeField
]
private
float
laneSwitchDuration
=
0.25f
;
[
SerializeField
]
private
float
maxForwardSpeed
=
7f
;
[
SerializeField
]
private
float
touchMovementSensitivity
=
0.05f
;
[
Header
(
"Visual"
)]
[
SerializeField
]
private
float
bobAmplitude
=
0.08f
;
...
...
@@ -141,6 +142,29 @@ namespace com.al_arcade.mcq
transform
.
rotation
=
Quaternion
.
Slerp
(
transform
.
rotation
,
Quaternion
.
identity
,
Time
.
deltaTime
*
8f
);
}
// touch movement
if
(
Input
.
touchCount
>
0
)
{
print
(
"touch detected"
);
Touch
touch
=
Input
.
GetTouch
(
0
);
if
(
touch
.
phase
==
TouchPhase
.
Moved
)
{
float
deltaX
=
touch
.
deltaPosition
.
x
*
touchMovementSensitivity
;
Vector3
pos
=
transform
.
position
;
pos
.
x
=
Mathf
.
Clamp
(
pos
.
x
+
deltaX
,
-
6f
,
6f
);
transform
.
position
=
pos
;
}
}
if
(
Input
.
GetMouseButton
(
0
))
{
float
deltaX
=
Input
.
GetAxis
(
"Mouse X"
)
*
touchMovementSensitivity
*
10f
;
Vector3
pos
=
transform
.
position
;
pos
.
x
=
Mathf
.
Clamp
(
pos
.
x
+
deltaX
,
-
6f
,
6f
);
transform
.
position
=
pos
;
}
}
private
void
HandleLaneInput
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment