The Daily Click ::. Forums ::. Klik Coding Help ::. Using the same key to activate and deactivate objects
 

Post Reply  Post Oekaki 
 

Posted By Message

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
3rd January, 2011 at 04:23:58 -

So i have a store in my game that i want to make it so when you press the S key it will move the position of the background object and all the clickable objects to where the gun shop is, and when you press S again, it will "close" or make the objects invisible.
but when i tried to do this it simply either A, doesnt do anything, or B, will flash the objects than they will disapear. i tried to make it so it limited the action for about 20 millaseconds, but than it doesnt do anything at all. How can this be done effectively?

 
[Game design makes my brain feel like its gonna explode.]

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
3rd January, 2011 at 06:13:42 -

Give the store a flag and have it so that when you press "S" the flag toggles. When it's off the store is closed, when it's on the store is open.

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

siven

I EAT ROCKS

Registered
  03/11/2008
Points
  604

Wii OwnerVIP Member
3rd January, 2011 at 06:28:52 -

Oh sweet. thats pretty simple, i should have thought of that lol.

 
[Game design makes my brain feel like its gonna explode.]

Mark McCauley



Registered
  18/02/2009
Points
  291

Has Donated, Thank You!VIP Member
5th January, 2011 at 10:17:37 -

another way
also.
setting a variable value of an active object on screen to contain a countdown number would help this.
for instance

-----CONDITION-------------------------------------------ACTION-----------------------------------------

-----------------------------------------Activeobject1(shop)------------menu-----------Player1----------


if hero on shop
+ 'S' pressed
+ valueA(activeobject1)=0-----------set valueA to 3----------------reappear-------ignore-control--
+ menu is invisible
+ limit once per action



if valueA(activeobject1)>0----------subtract 1 from valueA-------------------------------------------
+ every 1 second

if hero on shop
+ 'S' pressed
+ valueA(activeobject1)=0-----------set valueA to 3-------------make_invisible----restore-control--
+ menu is visible
+ limit once per action


this would stop the menu appearing and dissappearing so quick.

 
http://www.reddwarf.co.uk/forum/messages.cfm?threadid=44227736-C46F-AC56-02EBA05285818C14
   

Post Reply



 



Advertisement

Worth A Click