Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

move object in straight line issue

$
0
0
I am looking for a way to shoot an object in a straight line in front of the sprite in my game. I am making it a magician, So I need the spell to shoot in front of it in a straight line. I kind of achieved this. If you hold down 1, the fire ball travels down... but you can never make a new fire ball. I am after every time you hit 1, a fireball shoots and travels down on its own (or whichever the character is facing)

if(kbhit()){///right
		if(getch()== 'd'){
		move = 1;
		}
	if(getch()== 'a'){
		move =  3;
		}
	if(getch()== 'w'){
		move = 2;
		}
	if(getch()== 's'){
		move = 4;
		}
	if(getch()== '1'){
		move = 5;
		}
	}
       case 5:
	readimagefile("PIX\\fire_ball.jpg", x8+20, y8+40, x8+40, y8+60);
	y8 = y8 + 5;
	break;


Case 1 - 4 are just movement, which we have down. We have our sprite able to run all over the screen.

Anyone have any advice on what to look into with the shooting in a straight line etc...? I know readimagefile really slows down the program. Should I try getimage()?

Thanks for any help!

Viewing all articles
Browse latest Browse all 51036

Trending Articles