pingus-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions on code


From: David Philippi
Subject: Re: Questions on code
Date: Tue, 30 Mar 2004 21:07:46 +0000

Am Di, den 30.03.2004 schrieb John August um 11:16:
> 1. There are .xml and .plf files in the data directory. The code seems to
> only use the .xml files. Do the .plf (pingus level files) need to be
> there ? What's their history ?

What do you mean? Where do you want to have them? They are data after
all...

> 2. What is the code which "sets" a pingu to a given type (eg. stopper,
> digger etc) based on a mouse click on that pingu.

There's [request_]set_action in class Pingu, is that what you search
for?

> 3. What is the code which updates each pingu (eg. walking an extra step,
> digging an extra bit) ?

That would be the update() method of each action. (src/actions/*.cxx)

> 4. How does the code know a pingu has hit an obstacle, and needs to turn
> around (or go splat on the way down?) ?  Is it pixel overlap, or
> something more subtle ?

It's checked by pixel overlap, look into the update() methods of the
actions.

> - I note there are "sprite" routines with sprite.update() being called as
> part of Walker::Update (and similar). Normally, one would expect that
> "sprite" routines watch for collisions.

No, they just change the image drawn.

> 5. How does the code know to change a pingu's status - eg. Walker to Faller,
> Faller to Floater ? 

Each action knows the conditions on which it must change. For most
actions that means a change to Walker which may then change further.

> - Perhaps each pingu has a unique id which follows it from inception to death
> or removal from the screen, so you would have a "list" of pingus, generated
> by the thing which generates the pingu in each level ? (overlap with Q6)

There is class PinguHolder which has a list of all Pingu as well as of
those which are still alive.

> - It would seem that the pingu status (eg. Walker, Faller, Floater) determines
> how the pingu is displayed, along with what happens when it updates (eg.
> the Floater's y axis drop is smaller than that for a Faller).

Yes, each action has it's own draw() method and it's own sprite.

> - the ::draw is called for each pingu action type (eg. Walker, Faller, 
> Floater);this is frequently a simple call, but for some action types there 
> are further
> subtypes in the drawing - a Walker will need to be drawn differently depending
> on whether it is travelling left or right, a floater will have to be drawn
> differently depending on whether it is falling above or below the velocity at
> which it will squish.

Each action has it's own sprite associated with it, those sprites
contain the pictures for different directions.

> 6. How is the code which generates each of the pingus setup, and how does
> it operate ?
> More specifically :

Yes, the question above is a bit vague.

> 7. In setting up the mouse (or controller), what calls the routine
> Controller::Controller in input/controller.cxx ?

It's setup in gui/screen_manager.cxx.

> 8. How do StartScreen and StartScreenComponent operate ?

This I don't know without looking into the source myself. I'll come back
to this point when I find the time for this. Unless Ingo answers it
first of course. :-)

Bye David





reply via email to

[Prev in Thread] Current Thread [Next in Thread]