I am working on vehicle movement..seen here
http://indie-resource.com/zgta/index.html
(wasd keys to move, hit E to enter vehicle, Z is gas, X is brake) mouse to move and shoot. ) Just a test.
and currently I am using mouse angle to point the vehicle. Doesn't work well.
Is there a forward motion by angle method or something? In other words a way to move something forward by its current angle instead of having to manual add X and Y depending?
Maybe I am missing something?
1 decade ago
by Arantor
Use sin and cos to work out the vel.x and vel.y that the entity should have - all that Impact would do if it had the option is to do the exact same thing...
ugh was afraid of that, would help though if impact did it for you :) The last library I used had a speed and direction setting that would point the sprint n that direction and you just set the speed.
Thanks for the info.
ah ha! figured it out, you can test it now. Removed mouse detect and just had the w and s keys add .03 to the angle.
Thanks!
Anyone know why though the velocity is maxing out? I did not set the max.
1 decade ago
by Arantor
The thing is, there's a performance concern. If you had it so every entity had the potential, for every frame every entity, you'd be making that test and in the vast majority of cases you'd just be running that test unnecessarily - if you need it, set it for the few entities you actually need it for rather than forcing all of them to have a slight performance overhead.
As for maxing out on velocity, the base entity class defines a maxVel of 100 in each direction by default.
Also please note that any code placed online should be pushed through the bake tool as described in
http://impactjs.com/documentation/baking
I cannot get bake to work at all. Non stop errors. No good instructions.
i will try again and make a topic.
i am not sharing the link with anyone but here but I will take it down until I can bake it,
Thanks.
1 decade ago
by Arantor
Once we see the errors, we'll be able to help :)
k nevermind, found the issue, was a path related problem. :)
Updated both my games so they are baked. Thanks for the help! Love the community!
In case someone comes here from a search, remember you only need the
index.html
game-min.js
media folder
and thats it!
Page 1 of 1
« first
« previous
next ›
last »