Home Tutorials Forums Articles Blogs Movies Library Employment Press
Old 11-21-2007, 04:53 PM   #1
dark acalyte
Registered User
Join Date: Nov 2007
Posts: 10
Default diagonal movement + shooting problem

The game I am making is a side scroller so basically rightKeyPress is going forward, leftKeyPress goes back upKeyPress goes up, etc.etc.

the problem I'm having is that I can move diagonally in any direction, and i can move diagonally in any direction + shoot except for when im press up + left, going in the north west direction, i can shoot or move in that direction but not both, im not sure what the problem is but i can move+ shoot in any other direction, the movement + shoot code is down below so if anyone can figure it out thanks in advance.

this.onEnterFrame = function() {
	if (Key.isDown(Key.UP)) {
		if (ghost.hitTest(ghost._x-40, 0, true)) {
			ghost._y += 8;
		ghost._y -= 8;
	if (Key.isDown(Key.LEFT)) {
		if (ghost.hitTest(0, ghost._y, true)) {
			ghost._x += 7.5;
		ghost._x -= 7.5;
	if (Key.isDown(Key.DOWN)) {
		if (ghost.hitTest(ghost._x-40, 400, true)) {
			ghost._y -= 8;
		ghost._y += 8;
	if (Key.isDown(Key.RIGHT)) {
		if (ghost.hitTest(345, ghost._y, true)) {
			ghost._x -= 8.6;
		ghost._x += 9;
	if (Key.isDown(Key.SPACE)) {
		if (timer>=4) {
			_root.attachMovie("Particle", "Particle"+i, _root.getNextHighestDepth());
			_root["Particle"+i]._x = ghost._x+12;
			_root["Particle"+i]._y = ghost._y;
			timer = 0;
dark acalyte is offline   Reply With Quote

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Perplexed and seemingly unable to solve this problem Chris_C ActionScript 3.0 6 06-15-2007 04:01 PM
[AS2] Problem with shooting IamtheeApocalypse Gaming and Game Development 3 06-04-2007 03:14 AM
problem in movement of snake satish kumar ActionScript 2.0 2 05-20-2007 01:36 PM
Shooting Problem... JohnnyTightLips ActionScript 1.0 (and below) 6 04-09-2007 02:54 PM
movement problem peleplay ActionScript 1.0 (and below) 2 04-05-2005 07:17 PM

All times are GMT. The time now is 08:33 AM.

Follow actionscriptorg on Twitter


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2013 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.