Hundreds of features to explore
Games made in Construct
Your questions answered
Popular & trusted by schools and Universities world-wide
Construct 3 runs in the browser & works offline
Students do not need accounts with us
Our educational partners
Free education resources to use in the classroom
World class complete documentation
Official and community submitted guides
Learn and share with other game developers
Upload and play games from the Construct community
Game development stories & opinions
I have a doubt... I�d like to make my random interval between 1 and 7, and where I find the function syntax in C2 about it ?
The commom is random(x), in some examples...
Thx for any help
Yes it is Random(7) or you could do Random(1,7)
also when you are typing in the function "Random(" the function syntax will show up for you.
Thx again !!!!
I'm working on this. I only wanted whole numbers, so I used int(random(7)). Trying to figure out how to create a random calculation symbol appear now though :( random(*,/,-,+) doesn't seem to work.
AnD4D - try splitting a comma-separated string with a random index, like this:
tokenat("+,-,*,/", int(random(4)), ",")
I can't seem to crack it! http://dl.dropbox.com/u/50465867/TextAdventure.capx
I tried to use the code using the variable in an array, but it didn't work unless I used a global variable. I have the program set to have the "sum" text display the maths symbol. Am I going about this the completely wrong way?
your sum variable should be a text not a number
That's got it working... but now I just need to figure out how to work the expression. I have Var1&gsum&Var2... so that var1 and 2 are altered by whatever gsum is. Doesn't seem to like that, so I tried commas, which causes an error, and finally the + symbol, which works but gives the wrong results.
Succeeded using 4 events. Sure there's a way to do it using just one.
Develop games in your browser. Powerful, performant & highly capable.
You probabaly will have to separate calculation from character display.
local variable operation
on whatever you want to do -> set operation to random(4)
---- operation = 0 -> do an addition
---- operation = 1 -> do a substraction
---- operation = 2 -> do a multiply
---- operation = 3 -> do a divide
---- always -> set text to tokenat("+,-,*,/",operation,",")
There's really no way around that. 'cause you can't do something like
eval(n1&"*"&n2) to create and evaluate an operation from a string in c2