Giter VIP home page Giter VIP logo

headball2's Introduction

Head Soccer

Introduction

This is a Head Soccer style game - run on Ethereum - built by Cocos Creator.

Live Game: PLAY

(Make sure you are using Rinkeby and have some Ether in your account)

How to play

home

  • You must bet 0.1 ETH for each play turn. play

  • If you win, you will receive 0.2 ETH win

  • If you lose, you will lose your bet. lose

  • If draw, you will receive your bet back. draw1 draw2

How it works

  • Game Client: Cocos creator
  • Blockchain: Ethereum
  • Smart Contract: Truffle
  • Game-Blockchain Connection: Web3js

How to Build

Build Smart Contract

cp .env.example .env;
  • Install dependencies: yarn install
  • Compile && migrate to network you want (for example rinkeby):
truffle migrate --reset --network rinkeby
  • now you have built contracts in /assets/contracts

Build Game

  • Install Cocos Creator: https://www.cocos.com/en/creator (this game was built by version 2.2.0, use higher version may lead to lost metadata when open scene).
  • Open project, you will see 2 scene: Home and PlayGame
  • All connection beetween game and blockchain was implemented in class Web3Controller, in case you want to use your own smart contract, change the ContractABI inside the Web3Controller component.
  • Select Browser and run it.
  • If you want to publish anywhere on internet, built it and deploy on your server. References here: https://docs.cocos2d-x.org/creator/manual/en/publish/publish-web.html

Known issues and Future development

  • Due to short development duration, of course we made some bugs!
  • Because we have many asynchronous actions, sometime it will not update page when transaction is completed or when switch network.
  • In future, we will solve all bugs, and support more chain like Mainchain, Ropsten, Kovan, Loom, Tomochain....

Enjoy Coding

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.