123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|427|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Blitz -> Wait for Input

Fri, 13 Apr 2007, 09:05
mike_g
In Blitz if you want to have a program wait for a key press you can use WaitKey. What if you want to wait until either a key is pressed or the mouse has been clicked? Any suggestions?
Fri, 13 Apr 2007, 09:15
power mousey
yes mike

I just poll it thru the game loop.
Cause your mousey x,y coordinates may change
or a click can occur. then, I check for
any specific mouse click or area/boundary movement.
thats what I did in Cobra.
And also in Blitz myself.
Yet, its easier with the keyboard and presses too.

um...unless you want your program to stop and be static
until you wait for a mouse movement or mouse click.
Is this what you mean?
Better to poll thru and do nothing but loop it thru
the while or Repeat-Until loop...your game loop.

I hope you can follow.
And I hope this helps you.
Fri, 13 Apr 2007, 09:21
mike_g
Sorry I dont get what youre on about

I could do something like:

But what about keyboard input? KeyHit() requires a specific scan code. It would be nice if there was something like that that accepted any key. But It doesnt seem like there is.

Fri, 13 Apr 2007, 09:47
power mousey

well....

maybe I don't follow what you're trying to do.

lets see....

first, poll thru the loop.
tinker and determine if there isn't any mouse input
to delay a little more...if this is what you want.
Yet, in general the game loop will include a delay
or fix it in. Then, when a mouse input is 'moused in'
to the particular or specific action.

for the keyhit....perhaps a function
for particular keys to be tested and a return
flg for the particular key pressed and any intended action.
I have done this in Blitz and also in Python.
And with my particular player character Sprite object or
derived object from my class...that uses the Sprite object.
Slowly I'm learning and using Object Oriented programming.
Yet, thats another topic.

I hope this helps you anyway.
Other than that, I don't know.
Maybe others can help or suggest too?




Fri, 13 Apr 2007, 09:51
Jayenkai
AnyKey()
If a button is held down, it returns it's value, starting with Keyboard, then Mouse buttons, then Joystick directions and buttons.
Useful for redefining key settings.



-=-=-
''Load, Next List!''
Fri, 13 Apr 2007, 10:03
steve_ancell
I did this quite a while back, it's a bit long winded but it does the job.



|edit| As far as I know, it scans all keys and all mouse movements. |edit|
Fri, 13 Apr 2007, 10:29
power mousey

thank you Jay and steve.

for showing and offering your codes to help.

I understand a little bit know of whats
going on. Mike, I sorta know a little more
of whats going on and perhaps what you were
asking.


cheers,
power mousey
Fri, 13 Apr 2007, 10:50
mike_g
Thanks guys. I was hoping that there would be some way to do this without having to write some boring function for it. Now I dont have to cos you guys have done it for me Cheers
Fri, 13 Apr 2007, 17:06
steve_ancell
You're welcome Mike.

@ Kent... Hello Bro, great to see the great squeaky Power Mousey still going strong .
Fri, 13 Apr 2007, 17:50
power mousey

its

just had a Power AMP shortage.
Found more sources and reconnected too.


ahhhhhhhh!! True.



power mousey

Sat, 14 Apr 2007, 03:09
Phoenix
I think using GetKey() and GetMouse() would be faster than the others' examples, but I might be wrong.
Sat, 14 Apr 2007, 03:28
power mousey
well hey,

in Python using pygame

you use your event handling system witin the game loop
for all events that have happened within that particualr frame
and then from the list you choose and decide which event to
capture and perform what it is you want.

here is a code snippet example:




it will be a little different with using LiveWires since
events and handling them and determining which actions to
perform will be done in your objects that you create from
classes with the game module and classes of the LiveWire package.
I'm now starting to read up on it and learning it.
Most of the game handling events will be handled in
objects that you create from user defined classes
derived from the game objects and classes.
Being so used to running the 'game loop' and handing events
such as mouse,joystick, keypresses, etc within the loop or extended and called by functions too.

Lets say I'm learning and relearning too.

cheers
power mousey


new editey: I think I should be reading and coding.
Hot on the LiveWires too. So, adios amigos.





Sat, 14 Apr 2007, 11:21
steve_ancell
@ Phoenix...
I think using GetKey() and GetMouse() would be faster than the others' examples, but I might be wrong.


One problem with GetKey, it only returns keys with character values. The KeyDown/KeyHit method returns all standard keys exept [F-Lock] or media keys.
Sat, 14 Apr 2007, 11:30
mike_g
Yep, GetKey() wouldent work for non ASCII characters like ctrl or alt.
Sat, 14 Apr 2007, 11:40
power mousey

yeah, thats right.

you guys are right.

I put aside Python and especially Cobra
and fired up ye ole Blitz and looked into the help
files for these commands.

you all are absolutely right.
well...I should've known this. But,
I haven't used Blitz in such a long time.

thank you for your cooperation
and for the information

.
power mousey



Sat, 14 Apr 2007, 18:18
steve_ancell
@ The great squeaky one...

Kent !, that Python/Pygame that you posted. Am I correct in saying that Python is object oriented ?. It looks very similar to C#, Hmmm... Python looks interesting.
Sat, 14 Apr 2007, 18:49
power mousey
yes Python is mostly object oriented.
yet, you can write programs without the object orientation.

However, if you use and implement pygame and even
LiveWires then be ready freddy for a whole set
of object orientations and dependencies and interdependencies
of classes, subclasses, objects, attributes, methods
within both pygame and LiveWires. Packages and modules.
Rabbit holes within rabbit holes of underscores and dots too. You may like it. But you won't be in Kansas anymore nor Arkansas thats for sure!! If you follow the Python on the yellow brick road make sure you have your reference books and look em up a lot.

cheers
power mousey