Receding and Growing Actors
zajinakajazz
Member Posts: 43
Hi again, I am working on a game that uses cannon ball as basic projectile, and I was wondering if there is any tutorial for receding or growing actors? The idea is creating a 3 dimensional illusion by suggesting horizon line as the farthest reach, affecting all other characters to be foreshortened. The main character/ player character should be in front, so it's larger, and everyone else is smaller by distance. So basically, when i shoot I want the projectile to recede its size to meet the equivalent size of an enemy before it explode. Same idea applies if an enemy fires back, their projectile grows until it hits something. Any thoughts on this guys?
Comments
If the projectile is moving up from the bottom of the screen, constrain the width and height of the actor to a value relative to its y position. On a 320 height scene, you would use something like constrain self.size.height to max(self.startingHeight*(1-self.position.Y/320),5) where 5 is the minimum size of the projectile. Then do the same for width or constrain width to height.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Here's a demo.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
wow thanks man!! wow
You're welcome!
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User