[solved] How do I get instance properties

0 favourites
  • 5 posts
  • Hello,

    So here is the problem, I've got multiple instances of a platform objects (called platform, duh).

    And I'd like to resize one of those platforms every x seconds. I understand the event system, but how can I get and modify the x, and y position of one specific instance? I thought there will be something like this for instance:

    System->every 3 seconds->platform.[UID number or instance number]-> set x to platform.[UID number or instance number].X+100

    But I dont find the right grammar.... There has to be something like that.

    Thanks for reading and helping, I'm sure it's a noob question, but I am drowning in a sea of documentations and tutorials which seem to never need that function.

    edit: do I have to create my own ID instance variable and do something like system->every x seconds->platforms->if ID_instance_variable == y -> etc ?

  • You can assign different variable values to different instances in the editor, and you can pick that instance by comparing that variable's value at runtime.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks again for answering, but

    I'm trying to create a "procedural run and jump platform" game (with some subtleties, in short, platforms will be alterable).

    So I'd like to know how I can automate the assignement of an "ID variable". For now I'd like to be able to create new platform every 3 seconds with a "ID variable".

    Of course I manage to create a new platform with the system->every x seconds->system->createobject, but then I can't set the "ID variable".

    So I'm searching also over the platform->OnCreated event because it sounds like a "java constructor" so the answer should be near by. But I don't find it :/

    Any ideas ?

    EDIT: currently I'm trying to work it out with a global variable "platformNumber" which I increment every second, and use in the declaration of the "ID variable". But it does'nt feel clean if you what I mean.

  • When an object is created it is picked, and can be referenced within the tier it was created in.

    So set the variable there.

  • Oo, ok thanks I didn't know that. It's not really intuitive but hey, if it helps me I'm not gonna b*tch about that.

    Thanks a lot, you spared me troubles.

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