The Daily Click ::. Forums ::. Klik Coding Help ::. 8 direction lan game HELP PLEASE
 

Post Reply  Post Oekaki 
 

Posted By Message

archon



Registered
  29/07/2015 03:02:30
Points
  206
3rd August, 2015 at 03/08/2015 01:22:41 -

Hi so I have an 8 direction moo click lan game. you see each move and you see where you are but it doesn't show what direction you are facing it always shows one random direction so I see what direction I am facing but the other players don't. Here is the game mfa file. https://www.dropbox.com/s/6k05zwmekctswmg/lan%20game.mfa?dl=0

here is the built game, https://www.dropbox.com/s/dvubbk3pzvna4zm/lan%20game.exe?dl=0

please tell me or just change and send back a version where other players see the direction.
also the ip box is to type the ip of the host computer NOT YOUR OWN!

 
n/a

UrbanMonk

BRING BACK MITCH

Registered
  07/07/2008
Points
  49566

Has Donated, Thank You!Little Pirate!ARGH SignKliktober Special Award TagPicture Me This Round 33 Winner!The Outlaw!VIP MemberHasslevania 2!I am an April FoolKitty
Picture Me This Round 32 Winner!Picture Me This Round 42 Winner!Picture Me This Round 44 Winner!Picture Me This Round 53 Winner!
3rd August, 2015 at 03/08/2015 16:23:12 -

You can handle this two ways. You can either send the direction value along with the position data, or you could derive the direction from the client's movement delta.

To save bandwidth it might be better to calculate the animation direction of the client's player.

Just record the X and Y position of their character before repositioning them and then subtract their new position from it to get the direction value.

A very basic calculation could be this:
if Old X - New X > 0 then direction right
if Old X - New X < 0 then direction left
if Old Y - New Y > 0 then direction down
if Old Y - New Y < 0 the direction up

Obviously this is very basic and could be improved for better precision. This doesn't include intermediate directions obviously.

A single formula could also handle the directions too I'm sure by calculating the angle between the old and new position then converting it to 32 directions, but I don't feel like figuring it out atm.

 
n/a

archon



Registered
  29/07/2015 03:02:30
Points
  206
3rd August, 2015 at 03/08/2015 17:43:52 -


Originally Posted by -UrbanMonk-
You can handle this two ways. You can either send the direction value along with the position data, or you could derive the direction from the client's movement delta.

To save bandwidth it might be better to calculate the animation direction of the client's player.

Just record the X and Y position of their character before repositioning them and then subtract their new position from it to get the direction value.

A very basic calculation could be this:
if Old X - New X > 0 then direction right
if Old X - New X < 0 then direction left
if Old Y - New Y > 0 then direction down
if Old Y - New Y < 0 the direction up

Obviously this is very basic and could be improved for better precision. This doesn't include intermediate directions obviously.

A single formula could also handle the directions too I'm sure by calculating the angle between the old and new position then converting it to 32 directions, but I don't feel like figuring it out atm.

How wouldn't do that exactly I can't think of how you subtract the two values. Also how would I set old and new.

 
n/a

archon



Registered
  29/07/2015 03:02:30
Points
  206
3rd August, 2015 at 03/08/2015 17:52:55 -

No I need to send it to the other players. That would just change my direction I need the code that sends it.

 
n/a

Avantar1975



Registered
  01/12/2011
Points
  39
13th October, 2015 at 13/10/2015 12:23:19 -

I am not sure if this will help. I could not open your mfa file - it says unknown format - I probably have an outdated version.

I have made a couple of split-screen games before and the principle should be the same:
Just as you update the x and y position of your objects (characters, bullets, etc), you will also have to update the direction of your objects.

I have an 'Always' event and then I right click in the line underneath my object, then 'Direction' and then 'Select Direction' From there I click on the '1+1' for calculation and (for my split screen) I set it to a value for my shared data object.

I have never worked with Moo - but it should be exactly the same as you have done for the x and y positions but now just do it for direction too.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click