Does any one know how to make a store in a flash game? where you click on buttons in the store to buy things. Because I tried to in my game but couldn't get it to work.
1. A button to enter/leave the store/shop 2. Button that perform some functions of buying 3. Some variables to subtract the rupee's that the player has
If that doesn't work tell us what you tried to do in your game and give us and example.
The button to enter/ leave the shop works, but when I make buttons to unlock things in my game it doesn't work. I've tried to make it when you press the button it makes a blank movie clip visible. So that when the blank Movie Clip is visible it will set the other movie clips to visible, But the blank MC becomes visible before I click the button.
I've tried to make it when you press the button it makes a blank movie clip visible. So that when the blank Movie Clip is visible it will set the other movie clips to visible, But the blank MC becomes visible before I click the button.
It seems more like there is a problem in your code that is making it become visible before it is supposed to. We can't help you unless you show us that snippet of code.
I deleted the code because it didn't work. So right now I have a health power-Up in my game that is attached to the stage one every few seconds, so what I want to do is make it so that they have to click on the button in the store to buy it first before it starts attaching the itself to the stage
the code right now that adds the health power-Ups to the game is: class Health extends MovieClip powerupTimer += 1; if(powerupTimer > 240) { powerupTimer = 0; _root.attachMovie("Health", "Health" + _root.getNextHighestDepth(), _root.getNextHighestDepth()); }
Hmm, I must say the purpose (of the Health class) isn't entirely clear. The button in the store should be easy enough, just have it call a function where you enable the health powerup.
The class itself doesn't look like it will do that much however, if I'm reading it right you want it to attach a health movieclip every 240 frames (which is about every 8 seconds I suppose?) You can change it in two ways: either create an interval using setInterval, or put the code you've written in an onEnterFrame function - which will require it to be attached to the root, I think. My AS2 is quite rusty, so I could get it wrong
this code in my last post is the code on my car's onEnterFrame function telling it to add the health powerups. the code should really look like this: powerupTimer += 1; if(powerupTimer > 240) { powerupTimer = 0; _root.attachMovie("Health", "Health" + _root.getNextHighestDepth(), _root.getNextHighestDepth()); }
the code for my Health power up is this: class Health extends MovieClip { var speed; function onLoad() { speed = 20; _y = 100; _x = Math.random()*600 + 155; } function onEnterFrame() { _y += speed;