public void snakeRefresh(PlayZone map) { if (!utolso.equals(bodyparts[bodyparts.Count - 1])) { map.teliNegyzet(utolso.X, utolso.Y, Color.White); map.uresNegyzet(utolso.X, utolso.Y); } foreach (Vector element in removedBpsAt) { map.teliNegyzet(element.X, element.Y, Color.White); map.uresNegyzet(element.X, element.Y); } removedBpsAt.Clear(); map.teliNegyzet(bodyparts[0].X, bodyparts[0].Y, color); }
public void repositionApple(Apple apple) { var temp = map.kép.GetPixel(apple.X * map.mapUnit + 1, apple.Y * map.mapUnit + 1); for (int i = 0; i < appleList.Count; i++) { while (!map.kép.GetPixel(apple.X * map.mapUnit + 1, apple.Y * map.mapUnit + 1).Equals(Color.White) && appleList[i].equals(apple) && appleList[i] != apple) { map.teliNegyzet(apple.X, apple.Y, Color.White); map.uresNegyzet(apple.X, apple.Y); apple.X = rnd1.Next(map.mapSize); apple.Y = rnd1.Next(map.mapSize); map.teliNegyzet(apple.X, apple.Y, apple.color); } } }
public Snake(PlayZone map, Vector startingVector, Vector direction, Color color, Dictionary <Keys, Vector> controls) { for (int i = 0; i < 3; i++) { addPart(new Vector(startingVector.X - direction.X * i, startingVector.Y - direction.Y * i)); map.teliNegyzet(bodyparts[i].X, bodyparts[i].Y, color); } isDead = false; this.color = color; this.direction = direction; this.controls = controls; }
public void draw(PlayZone map) { map.teliNegyzet(X, Y, color); }