< Go Back

Star Wars Trench Run

About
It's a shoot-em-up game, that players have to get pass imperial ships and destroy Darth Vader for the rebel alliance to win. The game premise is a reconstruction of the Death Star scene in Star Wars: Episode IV A New Hope
Project Info
Role : Gameplay programmer
Time : 4 Weeks
Team Size : 1
Engine : Stencyl

Background

One of the most iconic moments in cinematic history is the Death Star trench run from Star Wars: Episode IV A New Hope, and as a devoted fan who has watched nearly every movie and animated series in the franchise, I knew this had to inspire my game. This is a fan-made game, created out of admiration for the incredible universe brought to life by George Lucas and Lucasfilm.

Imagine stepping into the cockpit of an X-wing, wielding its powerful arsenal: four laser cannons and two proton torpedo launchers. You’ll take on the role of Luke Skywalker, facing the challenge of a lifetime—the perilous raid to destroy the Death Star.

Special thanks to Lucasfilm for creating the universe that continues to inspire generations of fans and creators alike.

Cluster Missiles System

Challenges

To avoid giving the boss a monotonous behavior of only shooting forward, I researched Darth Vader's TIE Advanced and discovered that one of its armaments is the cluster missile. This inspired the idea of having the boss shoot multiple missiles in all directions for a specific duration, testing the player's dodging skills.

To implement this effectively, I need to thoroughly understand two key principles: the flight trajectories of the missiles and the direction in which each missile is facing. Both are crucial for creating a dynamic and challenging gameplay experience.

Solution

I revisited trigonometry to apply it to the trajectory of missiles in my game. Initially, I used the X-Speed and Y-Speed blocks, applying the CAH principles for horizontal movement and the SOH principles for vertical movement. However, I soon realized my calculations weren’t adding up correctly.

To simplify the process, I switched to using the Velocity block. By supplying the angle of the missile's direction and its speed, the Velocity block automatically combined the X and Y components for me. This made the calculations much more straightforward.

To ensure the missile's orientation matched its trajectory, I used the Turn block. By supplying the appropriate angle, the missile's direction aligned perfectly with its velocity. In the end, the result was a missile that not only flew right but also looked right.

Missile spawning script

Every 10 seconds, it will create the missile from the boss for an interval of 0.1 seconds.

Once 30 missiles have been created, stop the creation of the missiles.

Missile trajectory and orientation script

When the missile is created, randomly choose whether it will fly to the left or the right.

Next, generate a random angle between 1 and 15 degrees for the chosen direction. Apply this angle to set both the missile’s orientation and its velocity, ensuring it flies correctly in the selected direction.

What I Learned

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

What to improve

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

Results

Enemy Spawning System

Challenges

To create a randomized spawning behavior for enemies within the confines of the game space, accompanied by arrow indicators showing where the enemies will appear.

The key principles involve understanding how coordinates work within the game space and effectively storing multiple values, such as spawn locations to manage the indicators and enemy spawns.

Solution

In Stencyl, the origin of the game space is at the top-left corner of the screen, with dimensions of 480px in width and 800px in height. This means my game space spans from x: 0 to 480 and y: 0 to 800. Since there are walls on both sides of the game space, I subtract their combined width to determine the available spawning area.

To manage the spawns, I use a list to store the randomly generated coordinates. These coordinates are then used to set the positions for the arrow indicators and the enemies themselves.

Arrow indicator and enemy spawning script

First, the arrow indicators and enemies were, I created two lists to store the values of the random generated x position for both the TIE Interceptor and the TIE Fighter. I assigned manually placed to form a pattern.

Afterwards i created two list to store the values of the randomly generated x position for both the TIE Interceptor and the TIE Fighter. Assigned the values to the x position of the arrow indicators and enemies.

Then every 6 seconds, create the arrow indicators. Then another 3 seconds create the enemies.

Once this pattern of waves is done, it will start another wave of arrow indicators and enemies

What I Learned

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

What to improve

Far far away, behind the word mountains, far from the countries Vokalia and Consonantia, there live the blind texts. Separated they live in Bookmarksgrove right at the coast of the Semantics, a large language ocean. A small river named Duden flows by their place and supplies it with the necessary regelialia. It is a paradisematic country, in which roasted parts of sentences fly into your mouth.

Results

Play The Game On Itch.io