Tank Movement and correct angle to waypoint location
Zombiebrains
www.zombiebrains.co.ukMember, PRO Posts: 296
Hi folks
I was wondering if anyone knew a good tutorial to help me get my tank to move in the correct way.
Currently I have a tank actor who faces right automatically and when the player presses the screen it records the mouse positions X & Y as Tank Pos X & Y.
I can then set the waypoint to the new position and get the tank to move to the waypoint but I need to to rotate to the correct angle and go in a straight line as at the moment the tank actor just moves to the waypoint without it facing the waypoint!
Does anyone know a good trick to get my actor to face the right direction and move to its new waypoint.
I've been struggling for a while and getting nowhere fast.
Thanks all
It takes a Zombie to know a Zombie!!!
Comments
Could you clarify - you want to touch the screen, and have the tank rotate to face the point you touched and then move towards it?
This is only a very basic example, and would need fleshing out in a few ways before it was really usable in a game, but hopefully it'll give you some ideas.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Armelline, your a star...thats superb and just what I wonted it to do.
Thanks for your help on this...
It takes a Zombie to know a Zombie!!!
Be sure to read the notes - there's a couple of limitations you need to aware of! Should get you moving in the right direction though
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Hi @Zombiebrains
@ORBZ did a waypoints demo way back - and I think it actually uses a tank. Funny, eh?
The tank moves towards each waypoint, but not necessarily in a straight line, it'll round corners and change direction instead of instantly changing rotation to go towards the next waypoint. Having said that, @Armelline's demo may be better suited for you.
http://gshelper.com/shop/free-templates-and-tutorials/orbzample-waypoint-demo/
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
Absolutely recommend @ORBZ's demo. It's a great example of how elegant and effective GameSalad can be. Which method you want to use really comes down to how determined you are that the tank complete its rotation before beginning movement.
Contact me for custom work - Expert GS developer with 15 years of GS experience - Skype: armelline.support
Yep, its helps a lot...thats!
It takes a Zombie to know a Zombie!!!
Thanks for the heads up Bray, will take a look now
Just got the demo - very interesting and I like the way the tank turns slightly when it goes to the next waypoint. Will have a think on this as I quite like that look.
It takes a Zombie to know a Zombie!!!
Comment for @Braydon_SFX , and @Armelline
I am trying to find out a "How To" to create a tank game, but mostly for the "old style" tank game from Atari....just the traditional movement where if you move the arrow up, the tank goes forward in what direction the tank barrel is facing, and down arrow where the tank moves backward (not flipping the graphic). If you press the left and right arrows, the tank "rotates to the appropriate direction". Finally, if shooting, the bullet goes directly from the barrel, which ever direction the tank barrel is facing.
I hope this makes sense. Any tutorials or sample files that you know of that can illustrate the need?
Thank you in advance!!
http://forums.gamesalad.com/discussion/comment/278396/#Comment_278396 might be useful
@kculpepper, looks like @tmann might have beat me to it but I've attached a demo for you. Atari Tanks! was awesome in the day!
Up arrow to go forward, right and left arrows to rotate and space bar to shoot.
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page
Thank you BOTH @tmann and @jamie_c!!
You're welcome!
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page