LOADING
Loading
Hi , welcome back.
LogoutLOGOUT
 
  Lost password?  
Hi
 


Prev Previous Post   Next Post Next
  #1  
Old 10-15-2010, 03:20 PM
Nether_Traitor's Avatar
Nether_Traitor Nether_Traitor is offline
Registered User
 
Join Date: Oct 2010
Posts: 1
Rep Power: 0
Nether_Traitor is on a distinguished road
Movement Code

I'm hoping to learn more about making a game. So, I started with the basic movements. This is the code I use.

When you try this code, if you hold the key, it goes continually.

What I want to happen
1) When the key is held it won't travel continually.

Code:
onClipEvent(load){
	distance=48
}

onClipEvent(enterFrame){
	if(Key.isDown(Key.UP)){
		_y-=distance
	}
	else if(Key.isDown(Key.DOWN)){
		_y+=distance
	}
	else if(Key.isDown(Key.LEFT)){
		_x-=distance
	}
	else if(Key.isDown(Key.RIGHT)){
		_x+=distance
	}
}
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
listener not working in my code test84 Actionscript 2.0 0 02-28-2008 05:34 PM
Scottae's code...I need some more help please. lariat1997 Actionscript 2.0 6 02-23-2007 07:43 PM
add one fabric code on the flash garyww Flash MX 2004 6 09-01-2006 08:14 AM
Adobe's code only, still not compiling saumya ActionScript 3.0 3 04-26-2006 03:54 PM
Problems with XML code from reference book. PUP100 XML & Sockets 0 01-07-2005 12:07 PM




All times are GMT. The time now is 07:22 PM.