walk control help
- egoraptorfreak1
-
egoraptorfreak1
- Member since: Jul. 28, 2008
- Offline.
-
- Forum Stats
- Member
- Level 07
- Programmer
i need help with my walk code:
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { this._x += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.DOWN)) { this._y += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.UP)) { this._y += moveSpeed;}}
when i press left he goes right and when i press right he goes right and when i press up he goes down and when i press down he goes down any help
WTF happend to Duke Nukem, Crash Bandicoot and Spyro?
- AntiAliasProductionz
-
AntiAliasProductionz
- Member since: Apr. 20, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 10/13/10 08:20 PM, egoraptorfreak1 wrote: i need help with my walk code:
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { this._x += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.DOWN)) { this._y += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.UP)) { this._y += moveSpeed;}}
when i press left he goes right and when i press right he goes right and when i press up he goes down and when i press down he goes down any help
You're gonna have to make it
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.LEFT)) { this._x -= moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.DOWN)) { this._y -= moveSpeed;}}
onClipEvent (load) { moveSpeed = 10;}onClipEvent (enterFrame) { if (Key.isDown(Key.UP)) { this._y += moveSpeed;}} - AntiAliasProductionz
-
AntiAliasProductionz
- Member since: Apr. 20, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
should explain what i did, right?
You were trying to get the character to move +x and +y for both key presses. You want to make it so that it subtracts x (-x) to go down and subtracts y(-y) to go left.
- egoraptorfreak1
-
egoraptorfreak1
- Member since: Jul. 28, 2008
- Offline.
-
- Forum Stats
- Member
- Level 07
- Programmer
omg thank you, im am very happy and will list you in the secondary thing when i submit this flash!
WTF happend to Duke Nukem, Crash Bandicoot and Spyro?
- egoraptorfreak1
-
egoraptorfreak1
- Member since: Jul. 28, 2008
- Offline.
-
- Forum Stats
- Member
- Level 07
- Programmer
a u help me with one other thing plz i cant find a working tutorial for a hitTest any help?
WTF happend to Duke Nukem, Crash Bandicoot and Spyro?
- AntiAliasProductionz
-
AntiAliasProductionz
- Member since: Apr. 20, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
At 10/13/10 08:32 PM, egoraptorfreak1 wrote: a u help me with one other thing plz i cant find a working tutorial for a hitTest any help?
Sure you've seen this, but this works.
- AntiAliasProductionz
-
AntiAliasProductionz
- Member since: Apr. 20, 2008
- Offline.
-
- Forum Stats
- Member
- Level 08
- Blank Slate
onClipEvent (load) {
var moveSpeed = 10
if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed;}
if (Key.isDown(Key.LEFT)) { this._x -= moveSpeed;}
if (Key.isDown(Key.DOWN)) { this._y -= moveSpeed;}
if (Key.isDown(Key.UP)) { this._y += moveSpeed;}
}
by the way, you don't need all the onClipEvents
- egoraptorfreak1
-
egoraptorfreak1
- Member since: Jul. 28, 2008
- Offline.
-
- Forum Stats
- Member
- Level 07
- Programmer
hate to bother you again but...i work in as2....
WTF happend to Duke Nukem, Crash Bandicoot and Spyro?
- MintPaw
-
MintPaw
- Member since: Jun. 11, 2006
- Offline.
-
- Forum Stats
- Member
- Level 10
- Programmer
At 10/13/10 08:46 PM, egoraptorfreak1 wrote: hate to bother you again but...i work in as2....
This is all as2, it was just wrong.
onClipEvent (load) {
var moveSpeed = 10
}
onClipEvent(enterFrame){
if (Key.isDown(Key.RIGHT)) { this._x += moveSpeed;}
if (Key.isDown(Key.LEFT)) { this._x -= moveSpeed;}
if (Key.isDown(Key.DOWN)) { this._y -= moveSpeed;}
if (Key.isDown(Key.UP)) { this._y += moveSpeed;}
} 
