[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Squirrelly Movement Physics
I saw a fun demo of an action game where the hero is a bomb-chucking
squirrel. Though it was fun to run and jump around with that (similar to
the "Megaman X" series), I wanted to try building movement physics that
would feel more agile. So here's an experiment using Pygame, using just
hard-coded blocks for graphics:
Here's the code, declared public-domain:
http://kschnee.xepher.net/code/100123squirrel_demo.py.txt
You'll need the level.txt file in the same directory:
http://kschnee.xepher.net/code/level.txt
The game that got me thinking about this:
http://www.artspots.com/forum/topic/1829/midi-the-squirrel-game-demo
It's kind of fun to move around like this, but doing this sort of game
would depend more than anything else on getting the movement physics
*just right*, and it's not there yet. (And second priority would be good
animation, as with the Apple II-era "Prince of Persia".) I'm not used to
doing action games, so this kind of code is unfamiliar for me, and often
turned into an exercise in how many ways you can get a character
embedded in a wall.
This code got as far as letting you run (arrow keys), dash (hold
left-shift), jump (space), slide on ice (white blocks), and wall-jump
(jump while pressing against a wall).
I imagine a game where you're a squirrel-like character with a staff,
doing a lot of jumping and climbing.
-Maybe a dedicated "grab" button for climbing walls, some of which might
be in the background.
-Crouch button that would change the character's bounding box, making it
possible to run/slide through narrow spaces?
-Physics should be biased toward make the character seem agile. Eg. I
made the "check for a floor beneath player" code check points at both
bottom edges of the player, which means you can land on the very edge of
a platform and still balance.
-Air control during jumps is generally good in video games, but I had to
disable it for several frames during wall-jumps. Maybe when wall-jumping
from a left wall, temporarily treat holding left as though the player
were holding right?
-In the "Midi" game I referenced, the hero tends to stop when attacking,
which doesn't feel right. A staff also feels like a more appropriate
weapon. Some kind of run-and-whack attack?
-The Midi game also has smooth slopes you can run up/down instead of
jagged stairs like in my code. I'm not sure how to implement that,
especially since the Midi game doesn't handle the physics of that
running quite right. (You visibly fall with each step downhill.)
-Thought about using ODE for physics, but since ODE doesn't do friction
and would require special cases for stuff like wall-jumping, it might be
more trouble than it's worth.
Any thoughts or suggestions on this?