playMaker
Home
Store
Showcase
Tutorials
Forums
Manual
Wiki
About Us
Playmaker Forum
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email
?
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Join our
Discord Channel
Home
Help
Search
Login
Register
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
How can I do math on variables?
« previous
next »
Print
Pages: [
1
]
Go Down
Author
Topic: How can I do math on variables? (Read 2363 times)
grimmy
Junior Playmaker
Posts: 70
How can I do math on variables?
«
on:
April 06, 2013, 06:33:06 PM »
For example, I want 100 sprites placing in a nice line. How do I set an object to be positioned at a variable + or - an amount or with any math for that matter..eg:
HalfTheEggs=AllTheEggs/2
BigMoveAMount=NormalMoveAmount*5
..etc..
Basically I can see how to input variables but do I need to create new variables for every part of the equation?
Logged
Alex Chouls
Administrator
Hero Member
Posts: 4003
Official Playmaker Support
Re: How can I do math on variables?
«
Reply #1 on:
April 06, 2013, 06:37:37 PM »
You need to use a loop. E.g., loop through a state that places a new sprite adding an offset to a spawnPosition variable each time.
Checkout PlayMakerSamples\TestLab\Spawning\SpawnGrid for an example. That sample uses a delay between each spawn, but you can set that to 0 to spawn all the objects in a single frame.
Logged
grimmy
Junior Playmaker
Posts: 70
Re: How can I do math on variables?
«
Reply #2 on:
April 06, 2013, 06:58:12 PM »
Okay, but is there a way to use variables with math in an action? ..or do I have to create a new variable for each of the following instances?
Eg
ACTION:GUI Horizontal Slider 1 PARAM:Left Value VAR: Slider Position
ACTION:GUI Horizontal Slider 2 PARAM:Left Value VAR: Slider Position * 2
ACTION:GUI Horizontal Slider 3 PARAM:Left Value VAR: Slider Position * 3
Logged
jeanfabre
Administrator
Hero Member
Posts: 15500
Official Playmaker Support
Re: How can I do math on variables?
«
Reply #3 on:
May 14, 2013, 04:16:49 AM »
Hi
You might have to have one variable for each yes, especially if you want to use them differently in the end. IF it is just to reach a final variable, then you can reuse variable until you reach the final value.
bye,
Jean
Logged
Print
Pages: [
1
]
Go Up
« previous
next »
Playmaker Forum
»
PlayMaker Help & Tips
»
PlayMaker Help
(Moderator:
600
) »
How can I do math on variables?