# Help, new user,

**URL:** <https://forum.kirupa.com/t/help-new-user/320813>\
**Category:** flash\
**Created:** [April 2, 2011, 5:28am UTC](https://forum.kirupa.com/t/help-new-user/320813 "2011-04-02T05:28:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![zombiekiller222](https://avatars.discourse-cdn.com/v4/letter/z/cdc98d/32.png) [@zombiekiller222](https://forum.kirupa.com/u/zombiekiller222)\
**Post date:** [April 2, 2011, 5:28am UTC](https://forum.kirupa.com/t/help-new-user/320813/1 "2011-04-02T05:28:34Z")

</div>

EDIT: Read my second post. It is shorted and get’s right to the point.

```auto
**[U]FIRST POST[/U]**
> ***Some weeks ago i started a project with great enthusiasm but I had a little holiday and forgot about it :(. I now found the project lying in an old corner of my computer and decided to come back to it. The problem is that there is one piece of code that i was having problems with back then and it is the only code i don't understand/remember. When the program is run this piece of code crashes the program. If anyone has any idea on what i was trying to do or if anyone has a better way of moving my player, it would be very helpful if ya could tell me :D.***

```

(It is run every frame if the player is significantly far away from the mouse)

```auto
private function movePlayer(newa)
		{
			trace(_player.x)
			trace(_player.y)
			trace(newa)
			olda=[_player.x, _player.y]
			trace(olda)
			stepx=newa[0]-olda[0]
			stepy=newa[1]-olda[1]
			stepy2=0
			stepx2=0
			trace(stepx)
			trace(stepy)
			while (stepx2!=stepx || stepy2!=stepy)
			{
				if (stepx2/stepx < stepy2/stepy)
				{
					stepx2+=1
					if (stepx > 0)
					{
					_player.x+=1
					}
					else
					{
						_player.x-=1
					}
				}
				else
				{
					stepy2+=1
					if (stepy > 0)
					{
					_player.y+=1
					}
					else
					{
						_player.y-=1
					}
				}
			}

```
