Jump to content
  • Advertisement

wtfmates

Member
  • Content count

    5
  • Joined

  • Last visited

Community Reputation

109 Neutral

About wtfmates

  • Rank
    Newbie
  1. So, I finished a pong game and upped the ante to a clone of the game Snake. Now I want the "food" to spawn at a random Vector 2 every 3 or so seconds (I'll flesh out the mechanics later). I've got two food classes, one for "good food" and one for "bad food." The random positioning works adequately, but I'm unsure how to draw more than one. I'm thinking something along the lines of (psuedo code): if (counter <= 3) n = rand.next (0, 100); if (n <= 75) goodFoodList.Add(food) else badFoodList.Add(badfood) counter = 0; My food classes each have their own draw method that I call in the game1 class draw method to keep things from getting cluttered, so the draw would look like: foreach (Food food in goodFoodList) Food.draw(); Am I on the right track? Is there anything I need to include in the food classes to get this working properly? Is there a better way of doing things? Thanks in advance for the help. I really appreciate it.
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!