Giter Site home page Giter Site logo

touhou's Introduction

=======

Touhou Docs

engine for web-based bullet dodging game

Run 'python -m SimpleHTTPServer', then go to localhost:8000

To create a new level, make a new folder in the bosses folder. The structure should go:

bosses/name_of_boss
    images/
        boss_image1.png
        boss_image2.png
    boss.js
    images.js

images.js contains the names of all the images in the images folder, so the engine can load them all.

boss.js is where the majority of the code should go: this is where you specify all the bullet patterns, how the boss moves around, and so on.

Bullets

The most important part of the game. In the engine, every bullet has a class. Define a bullet class like so:

function BulletClassName(bullet)
{
    this.update = function()
    {
        engine.setBulletDirection(bullet, bullet.direction + 1);
    }
}

Every frame, the main engine will call the update function in every bullet currently on the screen. Bullets that leave the screen will be deleted automatically.

To create a bullet of a specific class, call the following engine function:

    engine.makeBullet(x, y, direction, speed, bulletclass, texturename);

Bullets have a direction, in degrees (0 to 360). They also have a speed. Each frame, the engine moves every bullet by their direction and speed.

Example of making a bullet:

    engine.makeBullet(50, 50, 90, 5, Generic, "images/player_bullet.png")

Engine

Everything you write in boss.js can call functions from the engine class.

engine.makeNamedSprite(name, texture, x, y)

Creates a sprite with a texture and x,y coordinated.

engine.spriteFromName(name)

Get a previously made sprite from its name.

engine.moveSprite(sprite, x, y)

Move sprite to positions x, y.

engine.rotateSprite(sprite, degrees)

Rotate a sprite, around the center.

engine.changeSpriteTexture(sprite, texturename)

Change a sprite's image to another.

engine.changeSpriteOpacity(sprite, opacity)

Change sprite's transparency, from 0 to 1.

engine.removeSprite(sprite)

Remove a sprite from the game.

touhou's People

Contributors

kvfrans avatar whyhellothere avatar wdpark avatar myh1000 avatar sjiang647 avatar kevinfang2 avatar

Watchers

terran avatar mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm avatar  avatar

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.