Easter Eggs

Started by , Fri 15/07/2005 05:12:10

Previous topic - Next topic

Monkey Mage

I'm trying to create an easter egg in my game for example if the user presses the 8 and b key together it will display a message.  The problem is that I can't figure out how to tell the editor to trigger the message if BOTH the 8 and the b key are pressed.  Help!

p.s. Sorry for posting two comments in one day but I just registered for the fourms.

Gilbert

Use the IsKeyPressed() function.

I'll recommend something like below to be placed in the repeatedly_execute() function:

if (IsKeyPressed('8')&&IsKeyPressed('B')) {
  //Do whatever you want here
}

Note also that you shouldn't make the combination too complicated, since some of the keyboards cannot register some of the multiple key combination pressed at the same time, but I think just checking if 2 keys are pressed simultaneously is okay for most of them.

Sam.

surely a 3 button pressed detection is available on all keyboards, ctrl+alt+del?
Bye bye thankyou I love you.

Mr Jake

Its type of keys, for example it doesn't detect W, D and S at the same time on my keyboard.

monkey0506

I think it registers Ctrl and Alt differently than other keys, which is why you can make keycode combinations using those keys.  Which is pretty much what Hotspot just said...but I don't know if it works with other keys like Home or F5.

Gilbert

Yeah, it also depends on the keyboard, for example for my keyboard at home, it can register two arrow keys pressed simultaneously, but not with another key pressed together (eg. up+left+A).

Sam.

well, that shows me.

I never had any problem with key bcombinations of any multitude. Althoiugh windows does like to interrupt with "stick key" warnings.
Bye bye thankyou I love you.

fovmester

Quote from: Monkey Mage on Fri 15/07/2005 05:12:10
p.s. Sorry for posting two comments in one day but I just registered for the fourms.

I don't think you have to excuse yourself seeing that most people here post about 3 to 5 "comments" a day. :)

Shane 'ProgZmax' Stevens

You'll also probably want to put a limit on what the easter egg does (if anything).  For example, if it gives you a score or a special item, you obviously don't want it doing that a second time, so use setglobalint and getglobalint (or a global of your choosing) to keep track on whether the easter egg has been accessed.  Also, since you've posted the combination in this thread, it would be a good idea to use a different one ;>.

SMF spam blocked by CleanTalk