Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Numerics;
- using Raylib_cs;
- public class Pileczka
- {
- public Vector2 Pozycja { get; private set; }
- public Vector2 Predkosc { get; private set; }
- private const float grawitacja = 0.5f;
- private const float wspolczynnikOdbicia = 0.95f;
- private const int dlugoscSladu = 20;
- private float speed = 5f;
- private List<Vector2> slad;
- public Pileczka(Vector2 pozycja)
- {
- Pozycja = pozycja;
- Random random = new Random();
- Predkosc = new Vector2(
- ((float)random.NextDouble() * 2 - 1) * speed,
- ((float)random.NextDouble() * 2 - 1) * speed
- );
- }
- public void Aktualizuj()
- {
- Vector2 nowaPredkosc = Predkosc;
- nowaPredkosc.Y += grawitacja;
- Vector2 nowaPozycja = Pozycja + nowaPredkosc;
- Raylib.DrawCircleV(nowaPozycja, 10, Color.Yellow);
- if (nowaPozycja.Y > Raylib.GetScreenHeight())
- {
- nowaPredkosc.Y *= -1;
- }
- Predkosc = nowaPredkosc;
- Pozycja = nowaPozycja;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement