I am making a jump and run game- i want my sprites to collect items that are worth points. I want these items to be randomly generated on my tile map.
Does anyone know how i can do this? I am using Visual C++ with SDL

Recommended Answers

All 7 Replies

How are you creating the tile map? A 2d Array?

the tile map is created in a level editor, no coding is required

It's really impossible to say without knowing the details of the level editor.

What are you trying to do? Copy a code and get more code from someone else and say
you did it? If you're not going to a programmer, then its ok, I guess. But if you
decide to become a programmer, then stop with this nonsense and start learning.

im not wanting to be a programmer, i am taking a course and one of the papers "is not a programming course" but its more about learning the ins and outs of games, and game play. So we haven't been taught any programming, but are expected to make games using C++. If i had the time and the teaching resource i would love to do this properly but for now this is the best i can do.

Look up srand and rand to generate random numbers.
If you have ten different item types, generate a number between 0 and 9 and create the item matching that number.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.