Making Space Invaders
-
wrote on 13 Apr 2022, 14:54 last edited by
I am re-making space invaders for a class project. And I wanted to know the documentation I would need in order to make objects move such as the little invaders and bullets.
Or even in general, what documentation would be needed in order to make the game Space Invaders.
-
I am re-making space invaders for a class project. And I wanted to know the documentation I would need in order to make objects move such as the little invaders and bullets.
Or even in general, what documentation would be needed in order to make the game Space Invaders.
wrote on 13 Apr 2022, 15:20 last edited by@treej4
I would use a QGraphicsScene. Create QGraphicsPixmapItems for your invader "sprites" and move them around. Just creating 2 sprites for each invader, with his "legs" open & closed, and alternating between them gives an authentic SI feel :) -
wrote on 13 Apr 2022, 16:38 last edited by
Gotcha, I'm assuming in QGraphicsScene there is some method that tracks an object moving? I think my hurdle will be getting the objects to move and tracking moving objects.
-
Gotcha, I'm assuming in QGraphicsScene there is some method that tracks an object moving? I think my hurdle will be getting the objects to move and tracking moving objects.
wrote on 13 Apr 2022, 17:28 last edited by JonB@treej4
The "objects" are allQGraphicsItem
s.QGraphicsPixmapItem
s areQGraphicsItem
s which hold a bitmap/picture. Each one is an object with its own (x,y) position which you can read and move. The scene keeps a list of these objects which you can access, and you can keep your own references/lists if you wish as well.You view the scene through a
QGraphicsView
attached to a scene. In your case you will want just one scene with one view. -
Hi,
You should take a look at the graphics view examples. For example, the colliding mice one will show you how to move elements and do collision detection.
-
Hi,
You should take a look at the graphics view examples. For example, the colliding mice one will show you how to move elements and do collision detection.
1/6