A lot a help needed here!

Hi everybody. Im pretty new to this gamedevelopment thing but im learning reallt fast. I have been learning by the Peach Pellen tutorials(Thanks peach ;). But now i have some questions that i cant find any tutorial on.

  1. In my game the player will collect money (silver and gold). The gold will have the doubble value than the silver. And when the player collects one of the coins, a value of money will be added to their “account”.

  2. I also want a shop-option where the player can buy stuff for the moneys. And i want a options for buying other colors for my character(a spiritesheet) for the money.

  3. My game will be a “Endless running game” so i want the camera to follow my character (who will be in the center of the screen).

How do i make this possible? Any links, tutorials or just tell me here in the thread :slight_smile:
PS Sorry for my bad English :stuck_out_tongue:

//B [import]uid: 119384 topic_id: 21016 reply_id: 321016[/import]

Great answers, gkirilow101 :slight_smile:

For the third, you’d not actually move the character as suggested above, but most likely you’d use a scrolling background. (I have an example of this on Techority and there’s also the Tilt Monster sample code that you can download which shows this as well.)

Link; http://blog.anscamobile.com/2011/05/sample-code-tilt-monster-game-now-open-source/

Peach :slight_smile: [import]uid: 52491 topic_id: 21016 reply_id: 83090[/import]

For 1: You need to make use of a variable, say “money”.
What you need to do is whenever the character has a collision with either a silver coin or a gold coin, to increment that variable accordingly. So in partial code:

 if(event.other.myName == "gold") then  
 money = money+2;  
 elseif(event.other.myName == "silver") then  
 money = money+1;  
 end  

For 2: You need to do a similar thing, but on collision you do another check, for example:

 if(event.other.myName == "green") then -- a green colour piece of clothing  
 if(money \> greenPrice) then  
 -- write code so player now wears green clothing bought  

You can do that for all the other types of clothes as well, notice how I put greenPrice there, you will need to declare some constants to store the values of the items.

For 3: I’m sure there would be tutorials about it somewhere, the way I think of is probably not the best way to go about it. If you just want your character in the center, then simply when you presses a button like a d-pad to move right, make the background move left, and vice-versa for moving left.

Edit: Sorry if 3 is unclear. You must make the background scroll in the opposite direction to which button you press on a d-pad is what I am trying to say.

For example, you have a d-pad button with an arrow facing left, when you push that, the background scrolls right and you make an animation showing the character moving left - but he’s not moving, it gives the impression he is, the character walks on the spot so to speak. This will allow the character to be able to go back and forth through the level and not just one way. If you only want to move one way, then just use a scrolling background as Peach suggested. [import]uid: 116225 topic_id: 21016 reply_id: 83043[/import]