Animation Based on Actor movement
Posted:
Tue Jul 11, 2006 8:59 pm
by shadowburn
Hi,
This may be related to Parent child relationship, however maybe not. How can I take 2 alternate backgrounds using transparency and make them move in the opposite direction when moving a centered character on the screen.
For instance, the infinite x background1 moves left once the character gets 20 pixels from the right side, and while its moving, the infinite x background 2 moves right once background1 starts moving left?
-Jon
draw actor
Posted:
Tue Jul 11, 2006 10:19 pm
by shadowburn
Get an error. x=center.x/20;
Illegal Structure Operation.
Cool.
Posted:
Wed Jul 12, 2006 6:09 pm
by shadowburn
As rediculous as this was, I coded the actor animations all up to work now. Though thier may have been some hidden settings somewhere I havent found or maybe im blind and just missing, im sure it might have simplified tha matter abit more. I really can say that I do enjoy the power of the scripting language though. It has greatly opened up some flexibility in me doing this with the actor entites. I will have to open up another post on a new question and issue though. Thanks for the earlier reply.
-Jon
Posted:
Thu Jul 13, 2006 12:44 am
by Game A Gogo
you need to have a center actor that follows the player and the screen is parented to
Posted:
Thu Jul 13, 2006 1:48 am
by Fuzzy
Game a Gogo wrote:maybe in draw actor:
- Code: Select all
x=center.x/20;
You cannot safely do this because x may equal zero, which may not be divided.
Here is a work around. Use multiplication.
- Code: Select all
x=center.x*0.05;
or slightly more obfuscated..
- Code: Select all
x=center.x*1/20;
but thats going to be messy. Trust me.
Posted:
Fri Jul 21, 2006 6:51 am
by DilloDude
Game a Gogo wrote:or maybe
- Code: Select all
x=center.x/20;
if(center.x==0)
{
center.x+=1;
}
That wont work because it is still dividing it by zero.
Try:
- Code: Select all
if (center.x != 0)
{
x = center.x/20;
}
else
{
x = 0;
}
But I think
- Code: Select all
x = center.x * .05;
is simpler
Posted:
Fri Jul 21, 2006 7:06 am
by DilloDude
ThreeFingerPete wrote:Game a Gogo wrote:maybe in draw actor:
- Code: Select all
x=center.x/20;
You cannot safely do this because x may equal zero, which may not be divided.
I just relized - this shouldn't be a problem because it is 0 divided by 20, which will be 0. It is when you have something divided by zero that you get the problem:
- Code: Select all
x = 20/center.x;
could produce problems.