Jump to content

  • Log In with Google      Sign In   
  • Create Account


Subscript

Member Since 23 Dec 2011
Offline Last Active Feb 04 2013 09:07 PM
-----

Topics I've Started

[Java]Socketing Player Movement[Help]

09 January 2012 - 10:21 PM

Alright, so I've been working with Java for quite some time and I'm trying to branch of into sockets now. I know the basics of them you could say, I built a working multi client chat on my own with the help of the Java docs on their site, not copy and pasting from some tutorial on the net. So I have potiential I would say. Anyways enough with the rambling. I'm trying to socket player movement now, and I'm a little bit stumped.

I was thinking about sending the x,y value of player to the server when a corresponding key is pressed and then have it send it back to the clients and add an image to those coords. Then I thought how unsufficiant that would be because everyone would have the same image and would not be able to implement a paperdoll system. I'm not too sure, all the help is appreciated. Thanks.

--------Long story short---------

I need some help on implementing a networked movement system.

[Java]Socketing Player Movement[Help]

09 January 2012 - 10:19 PM

Alright, so I've been working with Java for quite some time and I'm trying to branch of into sockets now. I know the basics of them you could say, I built a working multi client chat on my own with the help of the Java docs on their site, not copy and pasting from some tutorial on the net. So I have potiential I would say. Anyways enough with the rambling. I'm trying to socket player movement now, and I'm a little bit stumped.

I was thinking about sending the x,y value of player to the server when a corresponding key is pressed and then have it send it back to the clients and add an image to those coords. Then I thought how unsufficiant that would be because everyone would have the same image and would not be able to implement a paperdoll system. I'm not too sure, all the help is appreciated. Thanks.

--------Long story short---------

I need some help on implementing a networked movement system.

Move towards rotation.

23 December 2011 - 06:54 PM

Alright, so I'm trying to make my bullets move towards the rotation. This is my code for it.
function shoot(event:MouseEvent)
{
	var bullet:MovieClip = new bullet_mc();
	addChild(bullet);
	bullet.x = player.x;
	bullet.y = player.y;
	bullet.rotation = player.rotation;
	bullet.addEventListener(Event.ENTER_FRAME, moveBullets);
}

function moveBullets(event:Event):void
{
	event.target.x += 10*Math.sin(event.target.rotation*(Math.PI/180));
	event.target.y += 10*Math.cos(event.target.rotation*(Math.PI/180));
}

Now the problem is, when I shoot right the bullets go down, when I shoot left the bullets go up, when I shoot down the bullets go right and when I shoot up the bullets go left. Appreciate all the help, thanks.

PARTNERS