Animation Woes

Get help using Construct 2

Post » Sat Mar 29, 2014 7:45 pm

7Soul wrote:In my game (the one in my signature) I also have lots of weapons and you can shoot left and right. The way I did it is that the player has a variable called "direction", and when he faces right direction is 1, and left is -1. Bullets also have this variable, and it sets if it is mirrored or not

The weapons all move based on math, so no behaviors. And instead of setting its angle, I use a variable to tell the angle of the weapon movement.

Example:
Untitled-1.png


So did you have to do this for each separate projectile or is there a way to...idk what I'm thinking of (heh).

So what I should be doing is each weapon will have a variable for direction. But your math equation is giving me a headache.

Self = Were the object actually spawns right?
amovtype variable is the "angle" it moves and the second part is setting how fast it will fly?

The rest is just whooshing over my head.
B
8
S
1
Posts: 76
Reputation: 949

Post » Sat Mar 29, 2014 8:01 pm

I'm using families to group all bullets. But appears you're using the free version so you'll have to do it for each separate object

Let me break it down for you

self.X+(sin(self.aAngleMov)*(dt*self.speed*(1-paused)))

- Self refers to the object doing the action. Saying "Self.X" on an action for the "Bullet" is the same as saying "Bullet.X"

- "sin(self.aAngleMov)" gets the X-component for the angle (while "cos(self.aAngleMov)" gets the Y-component)

- "*(dt*self.speed*(1-paused))" is the speed. "dt" is so it moves at the same speed regardless of the fps. "speed" is an instance variable for the bullet. *(1-paused) is just because of how I made the pause in my game

So in the end, you're setting the X of the bullet to
"Its own X" plus "the X-component of its angle 'speed' times"
B
83
S
22
G
15
Posts: 1,039
Reputation: 15,219

Post » Sat Mar 29, 2014 8:07 pm

Oh no there just aren't any tutorials on families that I saw or anything like them.

Wow this is going to make things a lot easier.

Can't believe I was going to make a game without knowing what families are.

So ill try making all the bullets into a family and come back with what happens :)
B
8
S
1
Posts: 76
Reputation: 949

Post » Sun Mar 30, 2014 3:25 pm

7Soul wrote:I'm using families to group all bullets. But appears you're using the free version so you'll have to do it for each separate object

Let me break it down for you

self.X+(sin(self.aAngleMov)*(dt*self.speed*(1-paused)))

- Self refers to the object doing the action. Saying "Self.X" on an action for the "Bullet" is the same as saying "Bullet.X"

- "sin(self.aAngleMov)" gets the X-component for the angle (while "cos(self.aAngleMov)" gets the Y-component)

- "*(dt*self.speed*(1-paused))" is the speed. "dt" is so it moves at the same speed regardless of the fps. "speed" is an instance variable for the bullet. *(1-paused) is just because of how I made the pause in my game

So in the end, you're setting the X of the bullet to
"Its own X" plus "the X-component of its angle 'speed' times"


Ok I see what your getting at and it does make sense, but I can't seem to make it select a weapon like the knife or the cross or axe it just keeps randomly selecting one. The projectiles also don't seem to go anywhere no matter what I set the angle/ speed too.

Someone said I just spawn the knife and it takes on the "family properties" but that doesn't seem to work either.

I'm sorry I'm such a pain but your help is greatly appreciated :)
B
8
S
1
Posts: 76
Reputation: 949

Previous

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests