Einleitung
(Anm. des Übersetzers: Deutsche Fortsetzung beim wirklichen Inhalt (Liste mit wichtigen Punkten))
Be aware, this tutorial is not a guided "how to, step by step"/recipe that will give you the exact same clone once your done with it.
Instead, this is more a guided tour explaining how and why I did what I did.
I will pinpoint parts of the code in different places, but still working together as an ingame system that I planned/designed/coded.
What I'm aiming for with this tutorial is to have a full finished game with an increasing wave system (with background changes), a local score system (using array and webstorage) as well as displaying those, using three different layouts, which first is a loader/splash screen, having background music and sounds playing (or not), an easy way to pause/unpause the game and having everything done in the free edition, so in less than 100 events and using no more than 4 layers per layout.
There is still room in the current project to add more events.
For this tutorial I've used textures, music and sounds from the Scirra's free bundle that you can find on the here.
You can find the final project in the Arcade and download the capx there (in the arcade page for the game).
I hope to cover some points that beginners often ask in the forum with this tutorial.
Nevertheless, you really should have read and practised the Beginner's guide to Construct 2 before going on with this tutorial. It will show you some of C2's basic work flow (adding sprites/plugins, actions, conditions and events/subevents to a project, importing images/animations, ...) you should already be comfortable with.
I will try to stay logical and go through steps here, but it won't be a guided how-to signalling how to make every single event/action/condition within the editor.
Also, there will be quite some links to the manual or other resources and tutorials. If you are a beginner, really take the time to consult and understand those documents. It will take time, but it's really worth it.
As any learning, learning how to make a game takes time. Fortunately there's all the documentation on the website, just waiting for you to read.
Anyway, it is a massive amount of informations/new knowledge/new things to think about, don't hesitate to pause your reading, come-back to it the next day, even read it/practice it several times.
A lot of making a game is reflection, thoughts, time you think/craft your game in your mind and on paper rather than really "making"/coding the game.
This is part of the process anyway, the more educated thoughts you put into it before starting with the code, the easier the coding part of making the game should be.
Hier eine Liste mit einigen Punkten wie ich das Spiel haben möchte:
Asteroid Klon - Basis Mechanismus
..° Schiffsbewegung wie im Originalen Asteriod Spiel (Schwerkraft wie in Schwerelosigkeit, Schiff rotiert um sich selbst, kann sich vorwärts bewegen, bremsen, Schwung (Trägheit) vorhanden, erscheint beim verlassen einer Seite des Bildschirms auf der anderen,Kann auch auf Asteroiden schießen, vom Spieler gesteuert.
..° Asteroiden sind Felsen mit einer geraden Flugbahn, erscheinen auf der anderen Seite des Bildschirms wie das Schiff des Spielers, von einem Projektil getroffene Asteroiden zerplatzen in zwei kleinere Asteroiden, oder, wenn sie bereits die kleinsten erlaubten sind, wird der Asteroid zerstört. Einen Asteroiden trennen gibt einen Punkt, zerstören eines Asteroiden gibt 10 Punkte.
..° Wenn das Schiff mit einem Asteroiden zusammen stößt verliert es Leben - bis 0 - dann ist das Spiel zu ende. Der Asteroid wird nur zerstört, es gibt keine Punkte.
Pausen System
..° P Pausiert das Spiel, bis erneut P gedrückt wird.
..° Pause darf nur im Spiel auftreten, nicht zwischen Wellen (dann wird "Enter" erwartet).
Wellen System
..° Jede Welle spawnt eine bestimmte Anzahl an Asteroiden
..° Sobald alle Asteroiden zerstört wurden endet die Welle, wir warten auf eine Eingabe (Enter drücken) vom Spieler und wir starten die nächste Welle.
..° Das Hintergrundbild wird bei jeder Welle geändert
Punktesystem
..° Ein Array beinhaltet die 8 besten Punktestände
..° Ein Layout zeigt die 8 best Punktestände
..° Bei game-over wird der Spieler zu den Punkten gebracht und seine aktuellen Punkte werden mit den Punkten im Array verglichen. Wenn die Punkte höher sind als ein gespeicherter Punktestand,wird der neue Punktestand im Array aufgenommen und der alte Punktestand "rutscht" herunter oder aus dem Array.
..° Punktestände werden lokal gespeichert (im Webstorage) dann kann der Spieler von Session zu Session seine Punkte verbessern.
Audio
..° Der Nutzer kann entscheiden ob er Audio hören möchte oder nicht
..° Hintergrundmusik verändert sich bei jeder Welle
..° Sounds bei bestimmten Aktionen (Kollision mit einem Asteroiden, Asteroid zerstört, Asteroid und Schiff kollidieren gerade, Welle endet, Schiffsbewegung, der Spieler drck Enter in den Menüs)
Lebensbalken
..° Der Lebensbalken repräsentiert den Inhalt der Instanzvariablen "Health" (Gesundheit)
(Anm. des Übersetzers: Übersetzung wird für die nächsten Absätze wurden übersprungen, weiter bei Basis Mechanismus)
Some design decision - I chose not to put sound when the ship shoots for several reasons.
Mostly, I find it annoying. Most of the time in the game you are shooting. A repeating sound can be pretty annoying and also it is not the greatest feedback in my opinion.
Rather, having sound when a bullet hits an asteroid or destroys it (so when the player actually scores) is a better feedback.
The important is not to shoot, it is to hit.
Another decision I made was to use only the keyboard as input.
Sure today's computer have a mouse, but as my basic mechanics are all played with the keyboard, I wanted my "GUI inputs" to be as well.
That's why you press return between the layouts and the wave and don't click on some sprite.
That's why sounds and pause switches have a "keyboard short-cut" and no clicking button.
It's better for the player's comfort as he doesn't need to lift his hands from the keyboard suddenly.
Those decisions were made during the development, not beforehand. This is by testing and tweaking that you come to making those decisions, but it is important also to know why you made those.
I put them here now to kind of put you in the correct state of mind. Focusing your attention on those small details and the reasons why I give credit to them.
And after this motivational speech on carefully spending time thinking about your game, and this list of items I'll focus your attention on one of the most fabulous features of C2 : quick experimenting/prototyping.
There is no penalty for trying in C2, the worst thing that might happen is that when you preview your game, it doesn't behave as expected.
It can be frustrating, but the reward you get when you finally understand why it doesn't and fix your code so that the game executes as you meant it to is priceless.
A sum of new knowledge, experience, a better understanding of the inner workings of C2, of programming, the achievement of your mind overcoming the machine, of having a working game, possibly even a fun game to you as well as others.
So never hesitate to make a new project, throw a few plugins and behaviors in it and experiment, try, toy.
This is what often leads to the first prototypes. A prototype is a first playable representation of your game.
Having a fun working prototype is by no mean having achieved a game yet. It just allows you to display your game idea to other people and have comments and feedback on it.
Nevertheless it is an invaluable source of contentment already and, with C2, allows you to build upon quickly up to the point of finishing/polishing it as a complete game.
Note: Al through this tutorial, to have a better look at the images you can right click them, "Display the image".