[Magicor-devel] rev182: new classes
Status: Beta
Brought to you by:
petgeb
From: Claudio <cla...@ya...> - 2007-03-13 12:28:12
|
rev182 is out: . re_added some _test levels lost in rev181 . new dev mode: if you start magicor with the switch -d then you can use F11 to toggle between normal an frame by frame run. When in frame by frame each keydown in an unbinded key will advance one frame. . finally the basics for flying things begins to come: . New base classs PhysicsStoneSprite and supporting functions . First derived class Ball, mainly for demo and base class testing. Design goals for PhysicsStoneSprite class: It must suport natural description of the type: 'the thing moves so and so ( vertical, diagonal, with or without gravity ), and if it touches a blatzo it happens this ( explosions, bounces, atachs, etc ) Movement type can change at touchs or other events. Low level calcs ( update position, colision detection, bounce calculations, etc ) must be in the base class and supporting functions. How it is implemented: Unbounded functions implement the details of type of movement and world colision ( functions mov_h, mov_v, mov_diag ) The class instance has a member .move who stores the function that describes the current type of movement. Other unbounded functions are meant to proceess other kinematic related events: sprite colision detection, collision_bounce(), colision_atach(), etc Finally, there is a method .doAction() used to do the actions resulting of a sprite colision, and an analog for world colisions .onWorldColision. Then the .physics() method of the class is what glue all this. In pseudocode it looks like this: physics(): update position and velocity for each spriteTouched: self.doAction(self_action) // bounce, explode, heat, froze, ... spriteTouched(inflict_action) // idem The derived classes will provide initial movement type, and info about what sprites are meant to interact with, and how this iteraction work. Plus the apropiate media. Developement status for base class: . world colision done . sprite colision mostly done; remains special conditions to do. Note that colisions with old style classes can fail when the old style entity is moving. This is due ATM to old classes not detecting colisions with new classes, I still need to write this. . need to write proper new events, like atach, fision, heat, froze. Notes: . in this release the new class code is only executed ( excluding trivialities ) in levels when the new classes are present, so magicor will not see changes in stability in old levels. Feedback is wellcome. cya claudio --------------------------------- Preguntá. Respondé. Descubrí. Todo lo que querías saber, y lo que ni imaginabas, está en Yahoo! Respuestas (Beta). Probalo ya! |