Game help - Shops

Hello I am a relatively new person in game developing, I’m just a 7th grader trying to do something I thought would be fun. Well I started this app and it’s going well so far, but i want to add a upgrade shop option where people get coins from playing the game then using the coins to purchase upgrades to the; cannon, character, second chances, air resistance, gravity, etc - this game is one where you pick a angle and a power level to shoot a character as far as you can.

Thanks in advance,
Kashyap [import]uid: 149112 topic_id: 26421 reply_id: 326421[/import]

Also I would love to know how I can make gravity affect the character after it has left the cannon or slingshot. one more thing i would also like to know how to make the android to be in the “landscape” orientation, and how to make the objects scale on different devices since android is very exotic in it’s devices.

Thanks again,
Kashyap [import]uid: 149112 topic_id: 26421 reply_id: 107169[/import]

Hey there,

For the shop with coins earned playing, see this; http://techority.com/2012/04/08/making-an-upgrade-store-in-your-coronasdk-app/

Scaling you set in config.lua and would normally use letterbox which handles things automatically, basically.

For orientation, in build.settings do;
[lua]orientation =
{
default = “landscapeRight”,
},[/lua]

Peach :slight_smile: [import]uid: 52491 topic_id: 26421 reply_id: 107178[/import]

Thanks I’l check them both out! I hope it will work out I will let you know if you want. [import]uid: 149112 topic_id: 26421 reply_id: 107198[/import]

Also i have an error - my screen won’t go to the right once the guy has been shot out of the cannon and have the camera fixed on him - all it does is lets him fire out then he’s off screen. what should i do it does not scroll to the right either. [import]uid: 149112 topic_id: 26421 reply_id: 107207[/import]

Is there an error printed in the terminal or is it just not moving to the right? [import]uid: 52491 topic_id: 26421 reply_id: 107368[/import]

It just isnt moving right
[import]uid: 149112 topic_id: 26421 reply_id: 107427[/import]

You need to review your code then; have you managed to make it move right before? How are you actually controlling the movement? [import]uid: 52491 topic_id: 26421 reply_id: 107524[/import]

I think I have it completely wrong. Is there a place i can find out more i scrapped my old code now trying to find another resource. [import]uid: 149112 topic_id: 26421 reply_id: 107732[/import]

There’s the ghosts VS monsters sample code that shows the screen moving, although that may be a little advanced.

There’s also this video which if I recall shows similar effects but in a simpler way; http://seb.ly/2011/09/angry-birds-in-30-minutes-at-update-2011/

Peach :slight_smile: [import]uid: 52491 topic_id: 26421 reply_id: 107946[/import]

Wow thanks Peach you just helped me fix; cannons, firing, following players all in one 30 min video thanks! now it seems a bit more like a game but i keep getting more and more errors, my upgrade shops works fine but when the user buys a new cannon it does not show the new image or new cannon strength. help with this? [import]uid: 149112 topic_id: 26421 reply_id: 108008[/import]

No worries at all :slight_smile:

As to helping to fix your errors, you’d have to explain them first. Show errors, show related code, etc.

My guess is you are using Director or Storyboard and changing scenes and the value isn’t accessible so you’re getting nil? Either way, more info is needed. [import]uid: 52491 topic_id: 26421 reply_id: 108258[/import]

Hey so i tried to self correct it because i felt bad for asking you for everything… but now i have made it worse i believe i have my entire firing function wrong… any suggestions for the entire function including when a new cannon is added - say the projectile is player and it is already positions - to upgrade cannons would i use - if cannon1 == empty then
do nothing
elseif cannon1 == yes then
local cannon = display.newImage(images/cannon1.png)
— that does not seem to work and how would i increase the power after if this makes sense.
Thanks for all of your help,
Kashyap [import]uid: 149112 topic_id: 26421 reply_id: 108874[/import]

What is happening when you do that? Do you get errors?

My guess is cannon1 doesn’t = anything currently, maybe? It’s hard to tell what the exact issue is based on the above.

Also, if using words like empty/yes you should be making them strings, eg, “empty” and “yes”. Otherwise your program will be looking for variables named yes and empty. [import]uid: 52491 topic_id: 26421 reply_id: 108901[/import]

sorry for late reply! But i am using the ego form of saving and loading files so i made it so that if they did buy it then it would == yes and if they didn’t it would == empty. what would i have to do? and for the actual cannon i would add a linear impulse i know but i don’t know how to make the code so its like when you hold it down the power goes up and down and how to add more power to each cannon. im very confused right now [import]uid: 149112 topic_id: 26421 reply_id: 109305[/import]

In Ego it would automatically be set to “empty” until you set it to “yes”. Just look at the Ego samples, it shows how to save and that’s what you’d be doing, saving it as “yes”.

For holding down to power up, look into touch events and timers - you’d use a timer once the touch started to increase a variable/s for the x/y of the cannon then use those in the event.ended phase to shoot the ball. [import]uid: 52491 topic_id: 26421 reply_id: 109861[/import]