Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers AppGameKit Corner / Does AGK have a command similar to this?

Author
Message
mangue
7
Years of Service
User Offline
Joined: 19th Jun 2016
Location:
Posted: 23rd Jun 2016 07:51
https://docs.yoyogames.com/source/dadiospice/002_reference/movement%20and%20collisions/movement/move_towards_point.html

or this

https://www.scirra.com/manual/90/bullet

Both methods produce really smooth moviment.

Here's a demonstration https://www.youtube.com/watch?v=HucwGoBA9dU

I suspect we have to use physics in agk to achieve this without doing math?
29 games
18
Years of Service
User Offline
Joined: 23rd Nov 2005
Location: not entirely sure
Posted: 25th Jun 2016 14:05 Edited at: 25th Jun 2016 14:08
What's wrong with using maths? Also, the physics commands aren't a magic cure that sorts all these problems out. To be honest, if you don't know how to do this using maths then you're probably not going to be able to do this using the physics commands.

Anyway, here are two examples:

This one use basic trigonometry and Pythagoras to determine the direction and speed of the sprite moving toward the cursor.



This second one uses a simplified version of newton's laws of motion . I use this approach a lot for movement as you can add a bit of a bounce to the movement. Set the damping# value to 0.2 you'll see what I mean.



I hope these give you some ideas.
Hover Car Race Challenge! - available now on Google Play
Invaders of the 29th Dimension - available now on Google Play
Find me on indieDB
Blendman
10
Years of Service
User Offline
Joined: 17th Feb 2014
Location: Arkeos
Posted: 25th Jun 2016 18:35
@29games : thanks for your exemples, they are great
AGK2 tier1 - http://www.dracaena-studio.com
mangue
7
Years of Service
User Offline
Joined: 19th Jun 2016
Location:
Posted: 28th Jun 2016 07:22
Thank you. I tested both and they are awesome.

Still would be very nice if agk had lots of pre-built functions for this kind of stuff and others, just like construct 2 and gamemaker studio have. Would help a lot of people.

Login to post a reply

Server time is: 2024-03-28 15:07:51
Your offset time is: 2024-03-28 15:07:51