Okay, so the game I'm designing is a point-and-click shooter-type-thing. You're fixed in the middle of the screen, the enemies come from offscreen and towards you. You move your mouse and click either on the enemy or in its direction. Let's call the thing that hits and 'kills' the enemy "Bullet". So far, I've been able to make bullet zoom over to the place that's been clicked and kill the enemy, if there's one there. My problem is, the farthest the bullet will go is to where you clicked, so if you clicked just in front of the enemy (not on it or behind it) the bullet will not hit the enemy. I want to know how I can make the bullet sense if it did not hit the enemy and continue in the same direction until it either (a) hits the enemy or (b) touches the edge of the screen.
I am willing to upload the game to show you how far I've gotten, if you'd like to see the thing itself, rather than have it described to you.
Thanks in advance!
Offline
First of all, you might want this script:
when gf clicked forever point in direction [mouse-pointer v]Now, you might want to make some enemies, if it's a simple shoot game, make ten enemies and add this to each one.
when gf clicked set [speed v] to [1] forever point in direction [player v] move (speed) stepsnow, for the speed script
when gf clicked forever wait (seconds until enemies get faster) secs change [speed v] by [9]so that's one way, but here's another
when gf clicked forever go to x(x) y(y) point towards [player v] set [Hit v] to (0) repeat until <touching [player v]> or <(Hit) = [1]> move (speed) steps if <touching [bullet v]> set [Hit v] to (1) hide end if <touching [player v]> change [life v] by (-1) end end end wait (pick random (1) to (3)) secs show end
Last edited by gooeygoo (2012-08-18 16:17:02)
Offline
@ gooeygoo
Like I said, I've already started designing the game, and I've gotten pretty far on it. I won't be able to incorporate the first three scripts without changing nearly every part of the game I have done so far.
As for the last script: if I were to use it, what sprite would it go on? The enemy? The player? The bullet?
Offline
Another way: download this and look at the one-player scripts. Look at the blue bullet's scripts, I mean.
Offline
Zangooser wrote:
Firedrake969 wrote:
Another way: download this and look at the one-player scripts. Look at the blue bullet's scripts, I mean.
It works! Thank you!
Reporting topic to be closed~
Ok thanks. I make a lot of little games that turn out to be tutorials.... XD
Offline
Closed by request.
Offline