Comments (2)
There's nothing apecs-specific. And it is much cleaner with vector types. Get a direction vector between your two points and scale it by desired velocity. Add to the original position:
move velocity current target = current + normalize (current - target) ^* velocity
from apecs.
@dpwiz is right, you're doing a lot of vector math manually that a library like linear will allow you to express as vector math directly. That part isn't really apecs-specific.
Where apecs comes in is when you express that operation as a cmap over enemy positions.
The easiest thing is just to have a global step function that's called once per frame, and part of that step function is the logic above.
Some ECS libraries want you to get fancy with it and model each of these behaviors as if they ran on a separate dedicated thread, but for now that's completely unnecessary.
from apecs.
Related Issues (20)
- Add Generic instances for Component, Elem, Expl[Get|Set|Destroy|Members] HOT 10
- Argument order in Reacts.react HOT 2
- Passing keys between members/exists and get/set HOT 3
- apecs-physics 0.4.5 marked as broken on nix - 'readGenericPackageDescription' not in scope HOT 6
- How to handle multiple potential components HOT 7
- Template Haskell function requires me to import some symbols unqualified HOT 2
- apecs-stm: newEntity_ leads to a compilation error, not newEntity HOT 4
- v0.10 wish list HOT 1
- Order of components in `explMembers` matters HOT 6
- Build failure with GHC 9.2.1 HOT 1
- Why is there no getAll / members? HOT 12
- Please enhance Benchmark Comparison chart HOT 5
- error destroying component for entity seemingly guaranteed to have that component HOT 4
- lazy cfoldr and cfoldMap HOT 2
- Physics documentation is inaccurate HOT 6
- Judy-backed storage in IO HOT 5
- fails to build with ghc-9.4/Cabal-3.8 for Stackage Nightly
- New article for Apecs - maybe depreciate outdated one? HOT 1
- Apecs-Physics collision handlers still nonfunctional HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from apecs.