independent movement

Non-platform specific questions.

independent movement

Postby MudRat_02 » Mon Aug 13, 2007 1:12 pm

Ok, i've got a problem here and no (effective) way to solve it. In my game, i control a crosshair with the mouse (the crosshair actually indicates your aircraft's attitude) whereas in the middle of the screen is the objective. However, as the level progresses you encounter more and more turbulence that effectively makes it harder to keep your targeting crosshair in the target area that you shoot at the end of hte level (if you performed well enough).

So heres the problem with that scenario, i dont know how to make the crosshair slowly start to move around independently and randomly (to simulate random turbulence). All my attempts have ended up too static. Anyone have any ideas?
MudRat_02
 
Posts: 21
Joined: Thu Feb 01, 2007 2:04 am
Score: 0 Give a positive score

Postby pixelpoop » Mon Aug 13, 2007 5:56 pm

could you give your crosshairs some directional veloctiy and an angle then change them randomly?

create integer variable "i" then put this in the draw script.

i=rand(5);
if (i==0){angle=rand(360); directional_velocity=rand(3);}

or just jump around with x, y.

i=rand(5);
if (i==0){x+=rand(5)-2; y+=rand(5)-2;}
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby MudRat_02 » Tue Aug 14, 2007 6:58 am

ok that first option was quite good, but theres only one problem-
At the start of the game it says hit return to begin (which starts the timer and is also a keydown event to control the crosshair with the mouse). Your script worked great, but as soon as i hit enter to begin the game, i have complete control of the crosshair :? Any way i can fix that?
MudRat_02
 
Posts: 21
Joined: Thu Feb 01, 2007 2:04 am
Score: 0 Give a positive score

Postby Sgt. Sparky » Tue Aug 14, 2007 4:26 pm

MudRat_02 wrote:ok that first option was quite good, but theres only one problem-
At the start of the game it says hit return to begin (which starts the timer and is also a keydown event to control the crosshair with the mouse). Your script worked great, but as soon as i hit enter to begin the game, i have complete control of the crosshair :? Any way i can fix that?

just make a variable called turbulence(a global integer.)
and when the crosshair encounters turbulence:
Code: Select all
turbulence = 10 + rand(5);
x -= rand(turbulence);
x += rand(turbulence * 2;
y -= rand(turbulence);
y += rand(turbulence * 2);

and make that a code on a draw actor event. :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby MudRat_02 » Wed Aug 15, 2007 6:08 am

thanx man that worked great :D
The crosshair is moving very static and very quick though, i've been trying some stuff to see what I can do about that. The main problem at the moment is that the crosshair moves random so quick, and so random (lol) that i can just move the crosshair to the approximate target zone, the the crosshair will average in that area, winning the game for me :shock:

Heres what i think may remedy the problem
- Acceleration (to give the user some warning so they can counter the turbulence)
- Some sort of event (timer or something) that dictates how often the turbulence is randomly changed
- Basically, although the turbulence is random, I need to really have the crosshair randomly try and escape away from the target zone

If anyone has some ideas to how this could go down (the acceleration and the crosshair trying to get away from the center of the screen part mainly), dont hold back :D Thanx again for the help so far
MudRat_02
 
Posts: 21
Joined: Thu Feb 01, 2007 2:04 am
Score: 0 Give a positive score

Postby pixelpoop » Wed Aug 15, 2007 7:14 am

use part of the code I gave above to randomly change when the random happens:
i=rand(5);
if (i==0){//turbulence coding
}

Also maybe you could turn off and on the control of the crosshairs during turbulence.
User avatar
pixelpoop
 
Posts: 276
Joined: Tue Aug 29, 2006 9:32 pm
Score: 28 Give a positive score

Postby MudRat_02 » Wed Aug 15, 2007 8:09 am

cool, that helped slow it down. I've noticed that before i hit enter (to assume control of the crosshair) it goes randomly about teh screen, but after i hit enter it randomly flicks somewhere else before returning to the mouse location :? I'll need to add both acceleration (so its not so static) and i think that may solve the mouse override problem.

Maybe im going about this the wrong way. Obviously the mouse location is a big hurdle, because the crosshair can move, but the mouse cursor (as far as i know) cant be moved by this random thing really...or can it?

I've attached my project so far, if someone wants to have a crack at it (plz do! This is driving me up the wall :wink: )

(Btw, in case anyone is wondering lol, I know this is a strange game. Well, for starters its not really a 'game', rather, i'm simulating a set of airforce fighter pilot tests, and this basic scenario is the basis for a dozen or so similar ones. As it is, this doesnt come close to simulating the test, but it will eventually)
Attachments
Crosshair game.rar
(184.71 KiB) Downloaded 103 times
MudRat_02
 
Posts: 21
Joined: Thu Feb 01, 2007 2:04 am
Score: 0 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest