<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Карта прктик</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1 class="name">Карта практик</h1>
<iframe class="map" src="https://yandex.ru/map-widget/v1/?um=constructor%3A6e936e6d64437b893ff7beb8845d7627d3ef847f5d716a5f80c8e638d7545c6a&source=constructor" frameborder="0"></iframe>
<div class="ads">
<p class="bord1"><img src="https://thumbs.gfycat.com/SplendidNecessaryInganue-size_restricted.gif"><a href="https://www.oriflame.ru/"></a></p>
<p class = "bord2"><img src="http://4.bp.blogspot.com/-10DfLnqzJnM/U6YNlpRI23I/AAAAAAAAAFw/TF41ZrH00vY/s1600/action.gif"><a href="https://thumbs.gfycat.com/SplendidNecessaryInganue-size_restricted.gif"></a></p>
</div>
</body>
</html>
public float speed = 10f;
Rigidbody2D rb;
public float move = 0f;
public bool isGround = false;
public float jumpForce = 6f;
bool flip = false;
SpriteRenderer sprite;
public Animator animator;
// Start is called before the first frame update
void Start()
{
rb = GetComponent<Rigidbody2D>();
sprite = GetComponent<SpriteRenderer>();
}
// Update is called once per frame
void Update()
{
if(move == 0) {
animator.SetFloat("Speed", 0);
}else animator.SetFloat("Speed", Mathf.Abs(move));
if(move < 0) {
flip = true;
} else if (move > 0){
flip = false;
}
sprite.flipX = flip;
transform.Translate(transform.right * move * speed * Time.deltaTime);
if (isGround) {
animator.SetBool("Jump", false);
} else {
animator.SetBool("Jump", true);
}
}
public void Jump() {
if (isGround) {
rb.AddForce(transform.up * jumpForce, ForceMode2D.Impulse);
animator.SetTrigger("TakeOf");
}
}
public void movePlayer(int m) {
move = m;
}