How Do I Create Special Powers For A Character?
FallingBoxStudios
Freelance Graphic DesignerMember Posts: 822
Hi, I would like to know how to add special powers to a character,
basically my character walks automatically in the game but if you hold the screen (Use a special power) your character can stop moving, but how do I make you able to use the powers without accidentally using more then one power at a time, maybe this will help you understand.
Heres how i have set the rules for the first power:
Create attribute - Boolean - set to false
Rule: actor receives event - if mouse button is down.
Change Attribute: Boolean - to - true.
Destroy - Actor. (so it does not look like you still have that power)
Heres how I have set the second power:
Rule: actor receives event - if mouse button is down + attribute (boolean) is true.
Destroy - Actor.
The only problem is that the second the first power is used the other one gets used 1 second afterwards, how do I make it that if 1 power is in use you can't use the second power? and how do I add more then 2 powers (I can't figure it out yet) Thanks
Hunter.
basically my character walks automatically in the game but if you hold the screen (Use a special power) your character can stop moving, but how do I make you able to use the powers without accidentally using more then one power at a time, maybe this will help you understand.
Heres how i have set the rules for the first power:
Create attribute - Boolean - set to false
Rule: actor receives event - if mouse button is down.
Change Attribute: Boolean - to - true.
Destroy - Actor. (so it does not look like you still have that power)
Heres how I have set the second power:
Rule: actor receives event - if mouse button is down + attribute (boolean) is true.
Destroy - Actor.
The only problem is that the second the first power is used the other one gets used 1 second afterwards, how do I make it that if 1 power is in use you can't use the second power? and how do I add more then 2 powers (I can't figure it out yet) Thanks
Hunter.
Comments
What is the power? What does it do? If you can say that without giving any game secrets away, it might make it easier to understand what you want.
Rule: If Touched Is Released And game.Power Recently Used = False
[USE POWER]
Change Attribute: game.Power Recently Used = True
Timer: After 3 Seconds
Change Attribute: game.Power Recently Used = False
Replace 3 in the timer with the delay you want before the next one can be used
Every one would have the same code, but where I've got [USE POWER] is where you'd put the power code for that specific button/power
This will work on one power button, for the same power too.
Do you understand the code I gave above? Just reading it from the screen can you see and understand what it's doing?
Rule: If mouse button Is Released + game.Power - is - False
Destroy: actor
Change Attribute: game.Power Recently Used = True
Timer: After 3 Seconds
Change Attribute: game.Power Recently Used = False
If "Destroy: actor" is definitely the correct thing you want to do then try putting it on the end
Rule: If mouse button Is Released + game.Power - is - False
..Change Attribute: game.Power Recently Used = True
..Timer: After 3 Seconds
....Change Attribute: game.Power Recently Used = False
..Destroy: actor
The dots show how things are nested in the behavours.
I imagine the timer won't activate after 3 seconds once it's destroyed though.
Rule: If mouse button Is Released + game.Power Recently Used - is - False
..Change Attribute: self.Color.Alpha = 0
..Change Attribute: game.Power Recently Used = True
..Timer: After 3 Seconds
....Change Attribute: game.Power Recently Used = False
....Change Attribute: self.Color.Alpha = 1
If you want it to fade out rather than disappear completely you could use Interpolate.
Rule: If mouse button Is Down + game.Power - is - false.
.Change image: to a transparent image.
.Change Attribute: game.Power - to - true.
..Timer: After 3 Seconds,
..Change Attribute: game.Power - to - false.
so when you hold the screen (use a power) one of the 3 power actors disappears, leaving you with 2 powers, then if you hold the screen again (use a power) you're left with 1 power left, if you don't understand do you want me to send you the project file?
I'll PM you my email address
http://www.jamie-cross.net/?portfolio=gamesalad-recipe-006-platformer-powerups-double-jump-shield-shrink-and-hidden-block-mario-style
http://jamie-cross.net/posts/ ✮ Udemy: Introduction to Mobile Games Development ✮ Learn Mobile Game Development in One Day Using Gamesalad ✮ My Patreon Page