GithubHelp home page GithubHelp logo

bromagosa / ludus Goto Github PK

View Code? Open in Web Editor NEW
4.0 6.0 2.0 16.39 MB

Ludus is a game framework on top of Amber. The name stands for game or leisure in Latin.

License: MIT License

JavaScript 83.08% CSS 0.26% Smalltalk 16.65% Shell 0.01%

ludus's Introduction

Ludus for Amber

Ludus is an HTML5 canvas game framework for Amber Smalltalk.

You can find documentation for all methods and a couple of example games at the project page.

This repository is a move to Amber Smalltalk version 0.12.4 from the original Ludus as an Amber branch (version 0.9.1). The name stands for game or leisure in Latin.

Ludus has been ported from Amber 0.9.1 to Amber 0.12.4 by Philippe Back and Hannes Hirzel.

Prerequisites

  1. A web browser with reasonably good support for HTML5 canvas.
  2. nodejs. This will give you the node package manager npm as well.
  3. A global install of the amber npm package
  4. A global install of the bower client side package manager in order to install the dependencies

The amber and bower packages can be installed with the following command (In some cases you have to call npm with sudo npm):

npm install --global amber-cli bower

or the same thing, but less typing:

npm i -g amber-cli bower

Getting Started

Clone the repo, and start the amber server:

git clone https://github.com/bromagosa/Ludus.git
cd Ludus
amber serve

Point your browser to:

http://localhost:4000/dev.html

Enjoy!

The default port is 4000. Use --port to specify a custom port:

amber serve --port 9000

See also

Another Amber Smalltalk game framework by Masashi Umezawa https://github.com/mumez/enchant-from-amber . It wraps the enchantjs library with Amber Smalltalk code.

Submarine game in Amber https://github.com/johnnyt/subwars

ludus's People

Contributors

bromagosa avatar hhzl avatar johnnyt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hhzl rocketman66

ludus's Issues

Create methods to detect mouse events on Sprites

Sprite >> onMouseClickDo: aBlock

Then it should be called from Game >> step. For instance:

cow onMouseOverDo: [ (self soundNamed: 'moo') play ].
draggableBox whileMouseDownDo: [ draggableBox center: self mousePosition ].
quitIcon onMouseClickDo: [ self end ]

We need to consider conflicts between Game mouse events and Sprite mouse events. What to do if both elements have mouse events defined?

MemoryGame -- showing second tile

When the user clicks on a second tile which does not match the first one the two tiles are hidden too quickly. Add a delay before hiding the two tiles.

handleCardClick

    | clickedCard |

    clickedCard := cards detect: [ :which | which touchingMousePointer: self mousePosition ] ifNone: [ nil ].

    clickedCard ifNotNil: [
        (self soundNamed: clickedCard animalName) play.
        clickedCard showAnimal.
        lastSelectedCard 
            ifNil: [ lastSelectedCard := clickedCard ]
            ifNotNil: [
                lastSelectedCard = clickedCard 
                    ifTrue: [ clickedCard hideAnimal ]
                    ifFalse: [
                        lastSelectedCard animalName = clickedCard animalName 
                            ifTrue: [ Transcript show: 'yay :)'; cr ]
                            ifFalse: [ 
                                lastSelectedCard hideAnimal.
                                clickedCard hideAnimal ]].
                lastSelectedCard := nil.
            ]
    ]

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.