How do I lock object's axis?

0 favourites
  • 8 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • I am currently trying to simulate simplistic shadows that casts on a specific Y-axis but follows an object's X-axis.

    The shadow needs to be pinned to the object cause I will be spawning multiple objects casting multiple shadows.

    I am having problems trying to keep the shadow on the same Y-axis, however the pin behavior only allows the shadow to lock on the object's x and Y axis at the same time.

    Is there a possible way around this or a plugin that would solve this problem?

  • Instead of Pin you can simply set shadow X to object's X on every tick.

    Or you can try Pin+ addon, it allows to pin X and Y separately, as well as many other properties.

  • The problem with the first solution is when I spawn multiple instances of the object and shadow, when every tick the shadow copies the object's X, the program doesn't know which object to copy the X from since it's not in the same event. That would result in the shadow not moving at all.

    However I'll try Pin+, seems like it's the easiest solution.

  • when a shadow is created add an instance variable to the shadow and store the player UID in it so then you can do Pick shadow by comparaison shadow.variable = player.uid and then you can set x and y

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's not a problem. Add the sprite and the shadow objects to a container. When you spawn a new sprite, its shadow will be created automatically, and both instances will be logically linked together.

    So when you use "Shadow set X to Sprite.X", each shadow instance will be positioned to its own sprite instance.

    You can also use "For each":

    Every tick
    For each Sprite
     -> Set Shadow X to Sprite.X
     -> Set Shadow Y to ...
    
  • THat'S not how containers work you have to pick something with the events for the container thing to pick the containee? objects

    He said that objects will spawn multiple shadows though, so that won'T do if the amount is variable then trying to spawn another shadow will spawn another object and mess things up

  • , I think OP meant spawning multiple object instances, each of which will have its own (one) shadow. If this is the case, then containers will work perfectly.

    If one object should have multiple shadows, then he needs to use your solution with linking objects by UID.

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