Home > Web Front-end > JS Tutorial > How I Won the JSM Programming Challenge

How I Won the JSM Programming Challenge

Linda Hamilton
Release: 2024-09-20 06:50:02
Original
715 people have browsed it

How I Won the JSM Programming Challenge

In the vast universe of programming challenges, the JSM Programming Challenge stands out as a stellar opportunity for developers to showcase their skills and creativity. Last month's theme, "Video Games", set the stage for an exciting competition that pushed participants to explore new frontiers in game development. In this blog post, I'll share my journey of how I created "Cosmic Explorer", the game that ultimately led me to victory in this interstellar coding adventure.

Game: Cosmic Explorer
Code: GitHub

The Challenge: A Universe of Possibilities

The JSM Programming Challenge presented participants with a broad theme: "Video Games". We had the freedom to create a video game from scratch, utilize a game API, or even build a fan page for an existing game. The possibilities were as endless as the cosmos itself.

Choosing My Path: The Birth of Cosmic Explorer

After some brainstorming sessions with my girlfriend (who, spoiler alert, became my secret weapon in this challenge), we decided to embark on creating a space-based game. Thus, "Cosmic Explorer" was born - a game centered around space exploration, resource gathering from distant planets and battling enemy ships.

Preparing for the Journey: Learning Phaser

One of the most crucial decisions I made was choosing Phaser as my game development library. Despite never having created a web game before, I was drawn to Phaser's capabilities and decided to take the plunge. This decision set the stage for both my greatest challenge and my most significant learning experience during the competition.

// Example of initializing a Phaser game
const config = {
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    scene: {
        preload: preload,
        create: create,
        update: update
    }
};

const game = new Phaser.Game(config);
Copy after login

The Toughest Asteroid Field: Mastering Phaser

Learning Phaser while simultaneously developing a game was like navigating through an asteroid field at warp speed. The learning curve was steep, and at times, it felt like I was lost in space. However, as I progressed, things began to click into place. My code might have resembled spaghetti more than a neat star chart, but it got the job done.

// Example of adding a sprite in Phaser
function create() {
    this.add.image(400, 300, 'sky');
    this.player = this.physics.add.sprite(100, 450, 'player');
    this.player.setCollideWorldBounds(true);
}
Copy after login

Unexpected Nebulae: Fierce Competition

The challenge lasted for 24 days, thought I embarked on my journey 5 days after the initial launch. Throughout this time, I approached the development of Cosmic Explorer with a relaxed attitude. I worked on it when I felt inspired and took breaks when I needed to. This approach kept the process enjoyable and prevented burnout.

New Constellations: Learning and Growth

Through this challenge, I discovered a new constellation in my programming toolkit - Phaser. Learning to use this library opened up a whole new galaxy of possibilities in game development that I hadn't explored before.

The Winning Formula: Nostalgia and Smooth Gameplay

I believe what set Cosmic Explorer apart was its blend of nostalgia-inducing pixel art (which my amazing girlfriend made all of, and sure made me win) and modern gameplay elements. The parallax star background created an immersive experience, while the movement system received praise from many players. The retro-inspired sound effects added another layer of charm that resonated with the judges and players alike.

// Example of creating a parallax background
function create() {
    this.bg1 = this.add.tileSprite(0, 0, config.width, config.height, 'background1').setOrigin(0, 0);
    this.bg2 = this.add.tileSprite(0, 0, config.width, config.height, 'background2').setOrigin(0, 0);
}

function update() {
    this.bg1.tilePosition += 0.5;
    this.bg2.tilePosition += 1;
}
// This was not my solution, but the same principle. Check out the GitHub repo for the solution :)
Copy after login

Advice for Future Space Cadets

For those looking to embark on similar coding odysseys, here's my advice:

  1. Do it for fun, not as a job.
  2. Take breaks when you need them - the universe will still be there when you return.
  3. Embrace the learning experience.
  4. Don't be discouraged by fierce competition - use it as motivation.
  5. Remember, not winning doesn't mean your program isn't good. Every creation has value.

Conclusion

Winning the JSM Programming Challenge with Cosmic Explorer was an incredible journey through the vast expanse of game development. It taught me new skills, pushed my boundaries, and most importantly, reminded me of the joy of coding. Whether you're a seasoned space captain or a rookie cadet, I encourage you to take on similar challenges. You never know what new worlds you might discover.

Happy coding, and may your compile times be short and your bugs few!

The above is the detailed content of How I Won the JSM Programming Challenge. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template