how to make a pause feautre in unity
C#
# Set up the screen
# Python 3.7.3 chromebook
# Turtle
import turtle
# Set up the screen
turtle.Screen()
wn = turtle.Screen()
wn.bgcolor("black")
wn.title("Ping Pong game by Aaryan")
wn.setup(width=800, height=600)
wn.tracer(0)
# Paddle A
paddle_a = turtle.Turtle()
paddle_a.speed(0)
paddle_a.color("white")
paddle_a.shape("square")
paddle_a.penup()
paddle_a.goto(-350, 0)
paddle_a.shapesize(stretch_wid = 5, stretch_len = 1)
# Paddle B
paddle_b = turtle.Turtle()
paddle_b.speed(0)
paddle_b.color("white")
paddle_b.shape("square")
paddle_b.penup()
paddle_b.goto(350, 0)
paddle_b.shapesize(stretch_wid = 5, stretch_len = 1)
paddle_aspeed = 20
paddle_bspeed = 20
# Ball
ball = turtle.Turtle()
ball.shape("circle")
ball.color("white")
ball.dy = 2
ball.dx = 2
# Function
def paddle_a_up():
y = paddle_a.ycor()
y += paddle_aspeed
paddle_a.sety(y)
turtle.listen()
turtle.onkey(paddle_a_up, "Up")
def paddle_a_down():
y = paddle_a.ycor()
y -= paddle_aspeed
paddle_a.sety(y)
turtle.listen()
turtle.onkey(paddle_a_down, "Down")
def paddle_b_up():
y = paddle_b.ycor()
y += paddle_bspeed
paddle_b.sety(y)
turtle.listen()
turtle.onkey(paddle_b_up, "w")
def paddle_b_down():
y = paddle_b.ycor()
y -= paddle_bspeed
paddle_b.sety(y)
turtle.listen()
turtle.onkey(paddle_b_down, "s")
# Main game loop
while True:
wn.update()
#if UNITY_EDITOR //Code here for Editor only. #endifif(Pause){
Time.timeScale = 0;
}
else{
Time.timeScale = 1;
}
Also in C#:
- Title
- c# polymorphism
- Category
- C#
- Title
- c sharp list length
- Category
- C#
- Title
- letter at index of string c#
- Category
- C#
- Title
- c# date
- Category
- C#
- Title
- asp.net mvc 5 codefirst dropdown list
- Category
- C#
- Title
- unity round
- Category
- C#
- Title
- .net identity seed users and roles
- Category
- C#
- Title
- ubuntu: how to open the terminal from c#
- Category
- C#
- Title
- how to create more accurate searching c#
- Category
- C#
- Title
- page parent wpf
- Category
- C#
- Title
- Rigidbody.addforce
- Category
- C#
- Title
- c# sql duplicate key exception
- Category
- C#
- Title
- unity rotate around point
- Category
- C#
- Title
- unity3d debug pause
- Category
- C#
- Title
- wpf c# select folder path
- Category
- C#
- Title
- unity round vector 3 to nearest integer
- Category
- C#
- Title
- c# verify in class exist in list
- Category
- C#
- Title
- unity to integer
- Category
- C#
- Title
- how to remove space between string in c#
- Category
- C#
- Title
- see if two string arrays are equal c#
- Category
- C#
- Title
- or in unity
- Category
- C#
- Title
- unity simple fps controller
- Category
- C#
- Title
- query associative table ef6
- Category
- C#
- Title
- c# property get set
- Category
- C#
- Title
- how to clear console through script unity
- Category
- C#
- Title
- list.addrange in c#
- Category
- C#
- Title
- asp.net model display name
- Category
- C#
- Title
- check connection c#
- Category
- C#
- Title
- c# scene manager
- Category
- C#
- Title
- C# webclient immitate browser
- Category
- C#
- Title
- c# how to refresh your binding source
- Category
- C#
- Title
- making a list of chars in c#
- Category
- C#
- Title
- c# error "The name 'ViewBag' does not exist in the current context"
- Category
- C#
- Title
- .net 4.5 use tls 1.2
- Category
- C#
- Title
- how can convert string to int csharp
- Category
- C#
- Title
- font family behind code uwp c#
- Category
- C#
- Title
- Unity C# add slider into editor
- Category
- C#
- Title
- c# format number with leading zeros
- Category
- C#
- Title
- remove items from list c# condition
- Category
- C#
- Title
- how to edit a c# list
- Category
- C#
- Title
- ASP select box all states
- Category
- C#
- Title
- load information with txt file to uwp c#
- Category
- C#
- Title
- unity move character
- Category
- C#
- Title
- c# write variable in string
- Category
- C#
- Title
- c# change colour of console
- Category
- C#
- Title
- inheritance c#
- Category
- C#
- Title
- reload current scene unity
- Category
- C#
- Title
- unity set sprite transparency
- Category
- C#
- Title
- unity try get component
- Category
- C#
- Title
- how to get array of children transform
- Category
- C#
- Title
- c# postfix increment operator overload
- Category
- C#
- Title
- how to change scenes in unity
- Category
- C#
- Title
- convert base64 string to string c#
- Category
- C#
- Title
- c# datatable copy selected rows to another table
- Category
- C#
- Title
- what is the namespace for textmesh pro
- Category
- C#
- Title
- exception handling c#
- Category
- C#
- Title
- how to get specific length of row in matrix c#
- Category
- C#
- Title
- how consider the first caracter in Split c#
- Category
- C#
- Title
- unity list length
- Category
- C#
- Title
- unity material offset script
- Category
- C#
- Title
- how to run csharp in visual studio code
- Category
- C#
- Title
- unity input get axis
- Category
- C#
- Title
- how to sort string array alphabetically in c#
- Category
- C#
- Title
- how to store some variables on the device in unity
- Category
- C#
- Title
- unity particle system color
- Category
- C#
- Title
- C# random.Next error
- Category
- C#
- Title
- reference to gameobject in different scene unity
- Category
- C#
- Title
- c# reverse string
- Category
- C#
- Title
- how to reduce garbage collection c#
- Category
- C#
- Title
- unity how to make jump script
- Category
- C#
- Title
- switch case c# range
- Category
- C#
- Title
- example HttpClient c# Post
- Category
- C#
- Title
- unity c# set gameobject active
- Category
- C#
- Title
- rotate player unity
- Category
- C#
- Title
- c# while loop
- Category
- C#
- Title
- c# bool list count true
- Category
- C#
- Title
- c# read excel file
- Category
- C#
- Title
- unity c# foreach
- Category
- C#
- Title
- how to do cmd command c#
- Category
- C#
- Title
- stop ui from clipping wall
- Category
- C#
- Title
- same click event diffrenet buttonms c#
- Category
- C#
- Title
- linq in c#
- Category
- C#
- Title
- c# shorten an definition
- Category
- C#
- Title
- how to spawn coins randomly around the screen unity 2d
- Category
- C#
- Title
- sort c#
- Category
- C#
- Title
- how to get joypad axis input unity
- Category
- C#
- Title
- c# get list of all class fields
- Category
- C#
- Title
- .sh script: check if file exist
- Category
- C#
- Title
- how to make error sound c#
- Category
- C#
- Title
- C# events
- Category
- C#
- Title
- json tiers dot in name c#
- Category
- C#
- Title
- remove all array elements c#
- Category
- C#
- Title
- c# convert dictionary to anonymous object
- Category
- C#
- Title
- how to insert <input> datatype <td> in asp.net core table
- Category
- C#
- Title
- unity how to check object position
- Category
- C#
- Title
- unity find gameobject with layer
- Category
- C#
- Title
- MVC creating a counter for products
- Category
- C#
- Title
- null coalescing operator c#
- Category
- C#
- Title
- get user directory of file in c#
- Category
- C#
- Title
- c# make string null
- Category
- C#