Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Key presses and animation

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
New-Gen
Living in Obscurity...




Joined: 08 Apr 2009
Posts: 13
Location: South Africa, Pretoria

PostPosted: Wed May 13, 2009 3:20 am    Post subject: Key presses and animation Reply with quote

I'm trying to make an animation with back drops.

In this case I've got a press any key menu type thing that says the name of the game and under it, press any key.

This is two backdrops with the 'press any key' being a different shade from each other so it gives the appearence that the word is blinking.

What I want the code to do is to go from backdrop1 to backdrop2 and back again when [any key] is not being pressed and when [any key] is pressed it goes to to the 1st map.

I know this may be a simple thing to solve but I've been trying and trying and just can't get it right.
What ive got so far is that I used a while loop and it shows the first backdrop but does not alternate to the other and back again. If [any key] is pressed it just goes onto the map.
One time when I was figiting with the code it made that the word blinked when I held down [any key] and stopped when I let go of [any key]...also strangly, the Esc button took me to the 1st map.

Any help on how I could get this right?
_________________
Bannerfordamnation
Back to top
View user's profile Send private message Send e-mail
Camdog




Joined: 08 Aug 2003
Posts: 606

PostPosted: Wed May 13, 2009 8:21 am    Post subject: Reply with quote

It sounds like the problem here stems from the fact that you're waiting for two different things at the same time (a key press to advance, or a certain amount of time to flip the backdrops). I'd bypass this problem entirely by using timers:

Code:
plotscript, menu flashy thing, begin
  #do whatever needs doing leading up to the menu

  set timer(1, 1, speed, @menu flip 1)
  wait for key(any key)
  stop timer(1)

  #do whatever cleanup needs doing
end

plotscript, menu flip 1, begin
  show backdrop(1)
  set timer(1, 1, speed, @menu flip 2)
end

plotscript, menu flip 2, begin
  show backdrop(2)
  set timer(1, 1, speed, @menu flip 1)
end


The speed variable in the set timer commands above determine how quickly your menu flashes. Replace it with a number or a global variable.

In the future, it's helpful to post the code you're having problems with, so we can see exactly what you're doing.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group