straightliner, 5 days, 20 hours, 44 minutes




This is me diving into the depths of OpenGL (literally and figuratively). One of the reasons I started using pyglet was to get into learning OpenGL, so I'm trying to break the 2D plane I've been in up to now, 

That screen looks a little weird (well to be honest I kind of like it) because I'm rotating sprites about a ridiculous vector. I realized today I made a pretty glaring beginner mistake -- if I want to tilt the plane of my 2D sprites, I'm probably not going to be able to see them anymore! 

I don't quite know what to do about this yet, whether there's still a solution using 2D sprites, or if I need 3D sprites. I'll look into this tomorrow. My fall back plan is to wibble and wobble the plane in 2D only. My ideal is to really tilt the plane in 3D...I wonder how easy it would be to create 3D sprites from the 2D PNGs I've already made? A workable alternative would be to tilt the perspective only, so you're still looking at the 2D plane but not straight down on it, but I don't know if that's possible or if I'm even thinking of that correctly. 
I'm guessing not given my experiments today.

In any case, I have very simple level loading, a player (the circle) and enemies (the...enemy looking things) and stars the player can pick up. Everything is monochrome when loaded, I'll add hue to sprites at run-time as part of the gameplay. 

Arrow keys move the player, but falling off the rails is death (it'd be neat to have the player plunge into the z-depths if I can manage that with a GL perspective). 

 

(log in to comment)

Comments

Tilting the whole plane in 3d is quite easy once you get around that *everything* is tilted if you tilt the "camera" in the beginning of you rendering:

// A little C since I haven't done GL in Python
GL.MatrixMode(GL_MODELVIEW);
GL.LoadIdentity();
GL.Rotate(wobble, vx, vy, vz); // choose vector vx,vy,vz appropriately
GL.Translate(-cam.x, -cam.y, -cam.z);
// render objects

I think of the rendering order "backwards"; the first call will be "executed" last of all. So the rotation will be the last operation performed on all objects.
cocos2d has animation functions built in for this sort of thing.
(it also has tile mapping)