variables comparision

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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.

  • it's objectname('maxXP').

    You can find most basic information here:

  • 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!!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Hmm... Try objectname.value('maxXP') using the "Compare two values" condition again.

    And have you noticed this link : ... _Variables

  • 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.

  • 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.

  • 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!!!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)