Code Monkey home page Code Monkey logo

asobi's Introduction

Asobi

Pygame is a great package for Python to create games. Asobi is a wrapper for Pygame to give Python learners access to the game engine by reducing the amount of Python syntax and concepts needed to build simple games and/or animations.

At its simplest, a programmer needs only a scalar state variable, such as a number, a function to update the state variable every tick of the clock, and a functon to render the image. Asobi takes care of running the UI loop, passing events to the programmer, and offering a simplified API for displaying shapes and images.

Usage

The user will only need a single import to get started.

import asobi

Next, set the window dimensions, or use the default of 640x480.

window_size(640, 480)

Optionally set the clock rate of ticks per second. Default is 20.

tick_rate(10)

You can start drawing on the surface (window). If running interactively, the shapes will appear immediately. This helps learners see what effect their instructions are having on the image.

Preferrably, the user would define a rendering function (by default, render) that draws the image. If not using the default name, set the rendering function.

set_renderer(my_render)

Motivation

In my opinion, the pygame module isn't easy to use for a beginner--one with only a rudimentary knowledge of programming concepts. To run the Quick Start programs from the pygame.org website, one must know about:

  • tuples
  • arrays
  • objects and classes
  • variables
  • strings and integers
  • Booleans
  • Loops

One can, of course, just copy-and-paste the sample code. But I would prefer that someone with only a couple of basic concepts can get started making simple animations. With only knowledge of numbers, basic arithmetic, numeric variables, calling functions, and defining a function that takes and returns numeric values, one ought to be able make an animation such as a bouncing ball. With just a few more functions (and no extra programming concepts), keyboard events interactions can be added, allowing the learner to make a simple game.

asobi's People

Contributors

profbbrown avatar

Watchers

 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.