Giter VIP home page Giter VIP logo

Comments (7)

renatopp avatar renatopp commented on August 17, 2024

I'm not very familiar with ES6, but I would like to port b3 to it. How it is to translate es6 to es5? How we would use a Class system in the es5 if translated?

from behavior3js.

Oza94 avatar Oza94 commented on August 17, 2024

I'm currently following your tutorial for my own implementation in ES6. I will push my work on this repository.

I would like to use your lib in the future for the benefits of the editor (and merged efforts :) ), my implementation is a temporary work in the meantime because I need it now.

For documentation on ES6 and classes you can start with this page. To transpile ES6 to compatible ES5, you can use Babel, there is a live editor where you can try the new syntax and see live how it compile.

On my wip implementation, here is how the Sequence node implementation looks like:

import State from './../constants/state';
import BaseNode from './../basenode';

export default class Sequence extends BaseNode {
  constructor(childs) {
    super();

    this.name = 'Sequence';
    this.childs = [];
    childs.map(c => this.childs.push(c));
  }
  tick(tick) {
    for (var i = 0; i < this.childs.length; i += 1) {
      var status = this.childs[i].execute();

      if (status !== State.SUCCESS) {
        return status;
      }
    }

    return State.SUCCESS;
  }
}

from behavior3js.

ruyadorno avatar ruyadorno commented on August 17, 2024

I'd also like to recommend the work of Dr. Axel on both his blog and book

from behavior3js.

mickdekkers avatar mickdekkers commented on August 17, 2024

This issue seems to be covered by #21 (Modernize the codebase). @renatopp is it worth considering closing this issue and directing further discussion to #21?

from behavior3js.

danielepolencic avatar danielepolencic commented on August 17, 2024

@Oza94 would like to submit a PR to convert all classes to ES6?

from behavior3js.

Zielak avatar Zielak commented on August 17, 2024

Hi, @danielepolencic !
I couldn't wait so I gave it a try: #30

from behavior3js.

danielepolencic avatar danielepolencic commented on August 17, 2024

@Zielak made the dream come true ✨

#30

Closing this.

from behavior3js.

Related Issues (20)

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.