A little question
Re: A little question
That's good, but it move my camara too much and only right-left....I would like something like the metalhead one but random left-right-up-down....Is it possible?
Re: A little question
Code: Select all
RotateEntity("Player",0,random(-10,10),0);
For the up/down issue try this:
Code: Select all
TiltCamera((random(-10,10) + 0.0)/100);
Again, you can change the values of 'random(-10,10)' to make it tilt just the way you want.
Pain is only psychological.
Re: A little question
Excellent!!!I love youuu!!!!
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: A little question
Yeah,I forgot to mention that I edited the script (of course wih Juutis help ) so that the camera tilts only upwards.
Re: A little question
Oooh, OK, now i've got a little problem: when the cameratilt is little, it looks good, but when it's big, it's too sudden. I would want to know if there is any script to ''soft'' this effect. Thanks
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: A little question
You want to make the amera tilt sommth,right?...Well,I have no idea how to make it :D:D:D:D after all,I'm a newbie and the game I'm making is my first one.I just made the camera very very little,so it doesn't look so rough
Re: A little question
Try this one:
You can play around with the values of tilttimer, rotateamount and tiltamount to get it just like you want. tilttimer controls the time in seconds that the tilting should last. In this example it last 0.5 seconds. tiltamount and rotateamount control how fast the camera will tilt.
Code: Select all
{
tilttimer [0]
tiltamount [0]
rotateamount [0]
lastbullets [0]
Spawn[ ()
{
LowLevel("run");
} ]
run[ ()
{
self.ThinkTime = 0.04;
if(GetAttribute("bullets","Player") < lastbullets)
{
tilttimer = self.time + 0.5;
tiltamount = (random(-10,10) + 0.0)/100;
rotateamount = random(-10,10);
lastbullets = GetAttribute("bullets","Player");
}
if(tilttimer > self.time)
{
RotateEntity("Player",0,rotateamount,0);
TiltCamera(tiltamount);
}
if(GetAttribute("bullets","Player") > lastbullets)
{
lastbullets = GetAttribute("bullets","Player"); //update 'lastbullets' if the player receives more bullets
}
} ]
}
Pain is only psychological.
Re: A little question
You are a genious O_O
Thanks! Hope i will give you a reward for this
Thanks! Hope i will give you a reward for this
- metal_head
- Posts: 1244
- Joined: Sat Jan 05, 2008 8:31 pm
- Location: Bulgaria,Sofia
- Contact:
Re: A little question
WoW,I can't wait to try this one!!!When I get back home on monday,I'll take a look.If I understand right from the script,there's a time ammount which is used when the camera is being tilt.
Re: A little question
Little problem: the min. value I can put in the tilt and rotate is 1. y I put 0.8, 0.2, it doesn't work. Why?
Re: A little question
I'd bet(I'm at a friends house at the moment, otherwise I'd check the source) that the random command is converting the values to integers(thus, 0). You could try dividing the results. Say... 1.3 for the rotate, 150 or so for the tilt(instead of 100).
"So, what's the life of a programmer like?" "...Huh? What life?!"
RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
- QuestOfDreams
- Site Admin
- Posts: 1520
- Joined: Sun Jul 03, 2005 11:12 pm
- Location: Austria
- Contact:
Re: A little question
Manual:
int random(float Low, float High);
Returns a random integer number in the range of Low to High.
Re: A little question
In the tilit I can put, for example,
tiltamount = (random(-1,0) + 0.0)/200;
but, in the rotate?
rotateamount = random(-1,1);
Thanks
tiltamount = (random(-1,0) + 0.0)/200;
but, in the rotate?
rotateamount = random(-1,1);
Thanks
Re: A little question
Code: Select all
RotateEntity("Player",0,rotateamount * 0.8,0);
Code: Select all
{
tilttimer [0]
tiltamount [0]
rotateamount [0]
rotatefactor [0.8]
lastbullets [0]
Code: Select all
rotateamount = random(-10,10) * rotatefactor;
This can also be done in a more visible fashion, using:Juutis wrote:(random() returns an integer and adding 0.0 changes it into a float, which can then be divided)
Code: Select all
rotateamount = toFloat(random(-10,10))/100;
"So, what's the life of a programmer like?" "...Huh? What life?!"
RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
RF System X:
http://www.realityfactory.info/forum/vi ... f=9&t=3599
Re: A little question
edit:THANKS REALLY Now it's cool!!!!!