Does Anyone know a way to have the camera not only follow the main actor but also be able to shake when attacking enemies?
I know how to do each of these separately but not at the same time. Any help is appreciated, Thanks!
I'm thinking maybe if I have a camera control actor with these rules. (When camera shake is true interpolate self-position-x to self-position-x+10 otherwise constrain self-position -x to player-position-x)
@8bitninja said:
The above attempted kind of worked but was a little glitchy. Any other ideas? Anyone?
Try using camera rotation instead. Just kick the camera rotation a random amount between say -15 and 15. Then use some fancy interpolates and a timer to get it to rotate slightly past 0 and then settle back down to 0.
Or after the camera rotation is kicked, you could use the following constrain behavior to bring it back to 0 with a springy action. Constrain Attribute: [scene.Camera.Rotation] To: [( scene.Camera.Rotation +(0- scene.Camera.Rotation )*1.5)*.9]
Modify the numbers '1.5' and '.9' to suite your taste.
Thanks @RossmanBrothersGames Glad you jumped in. I was thinking of asking you directly because I know that Jump Jack does this quite well. So if I have a camera actor with its X position constrained to Player actor's X and then apply the shake only to the camera actor's Y position it should work. This sounds promising. I'll test this out later tonight and hopefully all is good. Thanks Guys!
also I realized my above code may be a little confusing since I used the word "shake" for two different attributes, you probably want to name them something different but I think you get the idea. Fore example
When "camerashake" is true might be better
Comments
I'm thinking maybe if I have a camera control actor with these rules. (When camera shake is true interpolate self-position-x to self-position-x+10 otherwise constrain self-position -x to player-position-x)
BRUNKT.com
Follow me at: Twitter - Instagram
Games and Templates
Appstore
The above attempted kind of worked but was a little glitchy. Any other ideas? Anyone?
BRUNKT.com
Follow me at: Twitter - Instagram
Games and Templates
Appstore
..
Try using camera rotation instead. Just kick the camera rotation a random amount between say -15 and 15. Then use some fancy interpolates and a timer to get it to rotate slightly past 0 and then settle back down to 0.
Or after the camera rotation is kicked, you could use the following constrain behavior to bring it back to 0 with a springy action.
Constrain Attribute: [scene.Camera.Rotation] To: [( scene.Camera.Rotation +(0- scene.Camera.Rotation )*1.5)*.9]
Modify the numbers '1.5' and '.9' to suite your taste.
@RThurman thanks! I'll give that a try.
BRUNKT.com
Follow me at: Twitter - Instagram
Games and Templates
Appstore
In a platformer I did it pretty easy moving up and down on the y coordinate
Make an integer call it "shake" make it equal 1 or more depending on how intense you want the shake
Here is a the code:
When Shake is true
Timer: Every 0.1 Secs
Change attribute shake to shake * (-1)
Change attribute cameraposition.y to cameraposition.y + shake
This switches shake back and forth from -1 to 1 moving the camer up and down rapidly, works pretty well
www.rossmanbrosgames.com
Thanks @RossmanBrothersGames Glad you jumped in. I was thinking of asking you directly because I know that Jump Jack does this quite well. So if I have a camera actor with its X position constrained to Player actor's X and then apply the shake only to the camera actor's Y position it should work. This sounds promising. I'll test this out later tonight and hopefully all is good. Thanks Guys!
BRUNKT.com
Follow me at: Twitter - Instagram
Games and Templates
Appstore
yep, that's why I did the y coordinate as well, it won't look right to use the x when the camera moves along that plane.
www.rossmanbrosgames.com
also I realized my above code may be a little confusing since I used the word "shake" for two different attributes, you probably want to name them something different but I think you get the idea. Fore example
When "camerashake" is true might be better
www.rossmanbrosgames.com