Setting object width according to a variable.

This forum is currently in read-only mode.
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • I've basically hit a wall here. I want the object to change it's width to be the value of a variable. If the variables value was 2, the object's width would be 2 pixels, if 35 it would be 35 pixels wide. I've tried setting it from set width of object and inputting the name of the global variable in the value box of the window. Anyone want to shed some light on this problem of mine?

    Thanks in advance!

  • Object: Set Width to global('variable')[/code:1vbb3qyv]
    
    That should be it.
    
    Things to double-check:
    [ul]
    [li]Make sure your variable is a number and not text[/li]
    [li]Make sure you're using the proper single quotes[/li]
    [li]Make sure you're not setting the width again after your event (this will override it)[/li]
    [li]Make sure your event is triggering properly (all conditions are met)[/li][/ul]
    
    If it's still not working then post your .cap.
  • It worked out exactly the way I wanted it to work! Thanks! I'm still working on learning all the little nuances of this program.

    I appreciate the help.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If you're struggling with the basics, maybe try out one of the tutorials?

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