[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [pygame] Introducing Pyzzle (long)
>It seems to me that you could write a hotspot editor
>with pygame + pyui fairly easily. All you actually
Duh. Why didn't I think of using pygame itself??
Oh well... That's why they pay you the big bucks.
From: firstname.lastname@example.org [mailto:email@example.com]On
Behalf Of Simon Britnell
Sent: Wednesday, June 27, 2001 12:26 PM
Subject: RE: [pygame] Introducing Pyzzle (long)
--- Michael Robin <firstname.lastname@example.org> wrote:
> >Since I'm new to pygame and game developing I
> thought id ask you how to go
> >about coding Myst style interface. Which really
> just is lots (100s) of pics
Don't forget animation sequences and sounds.
> You could also probably write a hot-spot editor in
> python+tkinter pretty quickly if your up on it.
It seems to me that you could write a hotspot editor
with pygame + pyui fairly easily. All you actually
need is the ability to represent a series of named
rectangles over top of an image. Other than that, you
just need a file load/save dialog and a rectangle
function name editor. You may want a couple of
function names for mouseover and click.
The core of your actual game engine can then be a
mouse-map processor which receives mouse events,
figures out which rectangle they're in and translates
them into appropriate function calls (possibly using
the builtin python function getattr). By keeping a
library of high-level functions that these game
specific functions & objects can call, you make it
very easy to code. Some examples:
# sets the mouse map that's currently driving the game
draw_image(image_file [, rect] )
# draw an image onto the screen
# load an animation sequence from a file
animation.once( [rect] )
# play the animation to completion once
animation.loop( start_stop, [rect] )
# play or stop playing the animation continuously
Lets suppose you have a setting with some doors which
may be opened and walked through and that you have
# proceed to new room
Then you'd load the image in your hotspot editor, draw
two rectangles (being the door and the switch) and
label them door_switch_click and doorway_click and
you're done. The rects and labels (obviously, I
guess) are only seen in the editor.
Finally, it occurs to me that you'll probably want a
couple of higher level constructs which will occur
repeatedly in this type of game: a Scene, a Button
and a MultiPositionSwitch.
A Scene is a collection of images, animations and
mouse maps that represent a single room or puzzle to
make switching from room to room / puzzle to puzzle
A Button is a rectangle which, when clicked plays an
animation and calls a function to change the game
A MultiPosition switch is a rectangle which, when
clicked, cycles through a series of possible settings.
Each setting has a seperate image and optionally a
function to call when that setting is reached. There
may also be transition animations between consecutive
settings. Finally, you want to be able to query the
switch setting from other functions to see how it's
Your hotspot editor could be aware of scenes, buttons
and switches with minimal extra effort.
Phew, impromptu brain dump. Hope it's helpful.
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail
pygame mailing list
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
pygame mailing list