GithubHelp home page GithubHelp logo

Add path:shift()? about jumper HOT 3 OPEN

yonaba avatar yonaba commented on August 16, 2024
Add path:shift()?

from jumper.

Comments (3)

Yonaba avatar Yonaba commented on August 16, 2024

Can I have some use cases/examples where such a method would be really useful ?

from jumper.

saschagehlich avatar saschagehlich commented on August 16, 2024

Well, if I have a path and I'd like an object to move along this path, I will make it move from node to node. As soon as I reached the node, I will want to get the next node and I don't need to know about the previous node any longer.

from jumper.

pancinteractive avatar pancinteractive commented on August 16, 2024

You can create this relatively easily by populating a table with all node values. I created something like this for use with Corona SDK, so you can move and actor along the path.

if path then
    print(('Path found! Length: %.2f'):format(path:getLength()))
    for node, count in path:nodes() do
    print(('Step: %d - x: %d - y: %d'):format(count, node:getX(), node:getY()))
    setX[#setX+1] = node:getX() -- populating coordinate table on each movement
    setY[#setY+1] = node:getY() -- populating coordinate table on each movement
    end
end

I assume this would be just as easy to bake into the actual library, but you know what they say about assuming.

from jumper.

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.