Giter Site home page Giter Site logo

kristoferlund / dog-eats-btc Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 1.51 MB

DOGE EATS BTC - A dog eats btc. A demo and a GPT-4 game creation tutorial.

Home Page: https://dog-eth-btc.on.fleek.co

JavaScript 92.62% HTML 7.38%
canvas game gpt-4 javascript openai

dog-eats-btc's Introduction

DOGE

DOGE EATS BTC

The Game

This game was created in a unique collaboration between Kristofer The Promptgiver and The Machine (OpenAI). This README serves as an overview of the project and a tutorial for newbie coders looking to learn how to create games using OpenAI.

Try the game here: https://dog-eth-btc.on.fleek.co

This is not a complete game. It is a work in progress and a demo, and I will continue to add features and polish the game over time. If you have any feedback or suggestions, please let me know!

Table of Contents

Introduction

This side-scrolling game features a doge eating Bitcoin (BTC) coins. When all the coins are eaten, the level is complete. The project combines OpenAI-generated code with visual assets created by Midjourney to form a complete and engaging game experience.

Creating the Game

Initial Setup

Kristofer The Promptgiver provided instructions and prompts to The Machine (OpenAI), which generated code snippets in response. The game is built using JavaScript and the HTML5 Canvas API.

The initial setup involved creating an HTML file with a canvas element and a linked JavaScript file:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Side-scrolling Platform Game</title>
  </head>
  <body>
    <canvas id="gameCanvas" width="800" height="600"></canvas>
    <script src="game.js"></script>
  </body>
</html>

Adding Graphics and Assets

Midjourney provided graphical assets for the game, including the dog character, coins, and background images. The Machine generated code to load and display these images using the Canvas API.

For example, to load and display the dog character:

let dogImage = new Image();
dogImage.src = 'path/to/dog-image.png';

ctx.drawImage(dogImage, dog.x, dog.y);

Adding Gameplay Elements

The Machine generated code for various gameplay elements, such as character movement, collision detection, and parallax scrolling backgrounds.

For example, to move the character based on keyboard input:

document.addEventListener("keydown", (e) => {
  if (e.key === "ArrowLeft") {
    dog.vx = -5;
  } else if (e.key === "ArrowRight") {
    dog.vx = 5;
  }
});
document.addEventListener("keyup", (e) => {
  if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
    dog.vx = 0;
  }
});

Collaboration and Prompting

Throughout the project, Kristofer The Promptgiver provided specific instructions and prompts to The Machine, which generated code snippets in response. This unique collaboration allowed the creation of a complete and engaging game experience.

For example, Kristofer prompted for parallax scrolling and moving coins:

"Can you help me make a parallax scrolling background for my game? I want it to move slower than the foreground and have multiple layers."

In response, The Machine provided code for parallax scrolling, which was then incorporated into the game.

See the full list of prompts and responses here.

Credits

  • All code generated by OpenAI
  • All images generated by Midjourney
  • This README written by OpenAI
  • Game created through collaboration between Kristofer The Promptgiver and The Machine (OpenAI)

dog-eats-btc's People

Contributors

kristoferlund avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aminlatifi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.