variables comparision

For questions about using Classic.

Post » Thu May 05, 2011 6:50 pm

Hi all, i'm new to construct, i'm a gamemaker user, but just discovered construct and i'm starting to like it a lot lol, i am experimenting with it and trying to implement a level up system into the ghost tutorial, my question is, how do i compare a variable to another one? for exemple i have i private variable called xp and another one called maxXP, i tried in the comparision event, but it tell's me that maxXp is not a recognised expression or usable object name. is there another way that i should do it? also tried str(maxXp) and player.maxXp, but nothing work.

thanks in advance for the answers, and sorry for my english, i'm french.
B
2
G
1
Posts: 18
Reputation: 486

Post » Thu May 05, 2011 7:10 pm

it's objectname('maxXP').

You can find most basic information here:
[url:2rajcana]http://sourceforge.net/apps/mediawiki/construct/index.php?title=Main_Page[/url:2rajcana]
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Thu May 05, 2011 7:14 pm

thank you very much!! I already checked this link, but found nothing about comparing two varibles, maybe i didn't check a the right place, but anyway thank you!!
B
2
G
1
Posts: 18
Reputation: 486

Post » Thu May 05, 2011 8:06 pm

Hmm... Try objectname.value('maxXP') using the "Compare two values" condition again.
And have you noticed this link :
http://sourceforge.net/apps/mediawiki/c ... _Variables
B
2
G
2
Posts: 34
Reputation: 718

Post » Fri May 06, 2011 12:48 am

daamee: thank you but Davioware's solutions was exacly what i was loocking for, the link that you sended seem to be for scripting, but thanks anyway because once i'll be familiar enough with the interface that's what i want to learn, like in gamemaker i don't event use a single "drag & drop" actions exept for the script one, i used for about a week or two at the begining, but quickly converted to script.
B
2
G
1
Posts: 18
Reputation: 486

Post » Fri May 06, 2011 1:06 am

if youre comparing actual individual objects' variables its a better idea to use "compare private variable" on said sprite/object instead of a system compare. system compares DONT evaluate for each instance, they evaluate only once.
B
52
S
7
G
6
Posts: 1,945
Reputation: 7,610

Post » Fri May 06, 2011 1:43 am

yep already know that, my player verify's it's own variables, thanks anyway, i'm not new to game programming, besides GM, i did a little bit of java, c++, python, i could probably do almost any kind of 2d games with those, specially python, but i have trouble with object oriented, so for now i would have to code it all in a single file, what is magic with construct and GM is that it does it all for you, plus you have a graphical interface to see exacly what you're doing, i am now migrating to construct simply because 1: it's open source, 2:from what i readed until now if i'm not mistaken construct is written in c++(i'm i right?) so if the 3d features continue to evolve it will be much faster than GM that is written in delphy, 3: i already knew when i downloaded it that it was compatible with python scripts, but i was making research for more advanced tutorials about that, and it seems that there is ways to use other language too.
So all of it makes it a lot more flexible than gameMaker, the only things in it that i found was missing, to be able to execute a script as an action(i know you can do it as an event), and a "create" event, that would be an event that would execute it's action only when the object is created, like in gamemaker, it's similar to the object propreties in construct, but more flexible in a way, but beside that i'm starting to like it a lot!!!
B
2
G
1
Posts: 18
Reputation: 486


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests