calminthenight's Forum Posts

  • It sounds like you have multiple objects with variables so you should be able to destroy them when you need without using this method, especially because if you are going to be able to pass the name that means you should be able to destroy it anyway.

    Something like:

    If item1 var_amount = 0 destroy item 1

    If item2 var_amount = 0 destroy item 2

    Or if you are using paid version you can use a family and add all the inventory items:

    If family"items" var_amount = 0 destroy items

    However if you want to pass a string to a function, in the event that you call the function, before the function call action, store the name in a local/global variable, and then check that variable inside the function, and at the end of the function clear the variable.

  • It's caused by minute errors that are inherent in the values. Change your numbers to whole numbers and add 1 each time and it works fine.

  • Parents/children are known as the Scene Graph in Construct 3 and they allow child objects to transform with certain aspects of the parent object e.g X&Y pos, size, Z-elevation etc.

    Containers allow for the automated picking of objects within a container, meaning you do not have to specify the specific instance of an object you are trying to pick when referencing that object in relation to another within the container.

    But I believe you may be looking for 'families'. You can add many object types to a family and then execute code on the family. Families can also have instance variables that are inherited by the objects within the family. Families is a paid only feature however.

    Elsewise an easy and simple way is to use a single object for your icons and use different animation frames to represent the different buildings.

    You could use something like:

    On Icon clicked:

    if icon is animation frame 1 - create buildingicon at mouse.x,mouse.y & set animation frame to 1

    if icon is animation frame 2 - create buildingicon at mouse.x,mouse.y & set animation frame to 2

    etc.

    Every tick if buildingicon exists - set position to mouse.x,mouse.y

  • No Worries. Have a read up on how the code/event sheet is executed. It can take a little while to wrap your head around but once you do your code will be much more efficient and you will run into less problems like these.

    construct.net/en/make-games/manuals/construct-3/project-primitives/events

    construct.net/en/make-games/manuals/construct-3/project-primitives/events/how-events-work

    construct.net/en/make-games/manuals/construct-3/project-primitives/events/sub-events

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ok I understand the performance difference now using the erase tile action. I'll play with it in my spare time and see if I can come up with anything

  • The pick nearest/furthest condition is found in the size & position section of the object you are trying to pick. That being said, using containers like suggested is a much better solution. If you add the text into a container on the block object, the current method you are using should work as the block is picked by the collision and then when you reference the text it will automatically pick the instance that is in the container with that block.

  • You have a lot of conflicting animation calls. In some events you are telling one animation to run based on a condition, and in another event you are telling a different animation to run based on the same condition. Your structure was causing some problems also. I have disable all your other events that trigger animations and re structured the "pickup and drop pick" section so that the pick animations work as intended. You should compare it to your original structure to see what the differences are. You will also need to go back through your other events that trigger animations and define more conditions that determine if those animations are played or not so that they don't interfere with any others.

    1drv.ms/u/s!AkmrWgxeuxlKhIcyyzqC6bgjuML71Q

  • Post a link to your project file and I'll have a look

  • Add trigger once while true beneath the inverted 'animation is playing' condition and see. It could be because you are using a boolean state to trigger the animation that every tick that that condition is true it is starting the animation, thereby never getting passed the first frame.

  • Post your project file so people can see what you have done. This is impossible to analyse without it.

  • You need to use a container. Add the enemy sprite into a container on your controller object, then when you create/spawn a controller, the enemy sprite will be automatically created at the same location. After the create action, in the same event, you can add the enemy sprite as a child of the controller.

    Then for the collision event you need: Controller on collision with XYZ - set Enemy Sprite animation to "collision animation".

  • Something like: Ball - On collision with block - pick text nearest to ball - set text to XYZ should work

  • If you have chosen to have the child object transform with the x and y positions of the parent then this will interfere with any independent movement of the child object.

    If not, you can use instance variables to store the X and Y coordinates of the object and then use them to navigate back to.

    For example.

    On left click

    - Set object var_x to self.x

    - Set object var_y to self.y

    - set position to mouse.x, mouse.y

    On right click

    - set position to self.var_x, self.var_y

    If you want it to transform with the parent object and the parent object is also moving, you can still use variables to store the position but you would use distance and angle to the parent instead of self.x self.y.

    For example.

    On left click

    - set object var_distance to [distance(parent.x,parent.y,self.x,self.y)]

    - set object var_angle to [angle(parent.x,parent.y,self.x,self.y)]

    - move to mouse.x, mouse.y

    On right click

    - Set position to

    X: [parent.X+cos(self.var_angle)*self.var_distance] Y:[parent.Y+sin(self.var_angle)*self.var_distance]

  • Have at look at my solution in this thread. They are set to automatically find a target if they don't have one but you can replace that with on object clicked or whatever your conditions need to be.

    construct.net/en/forum/construct-3/how-do-i-8/why-not-enemies-attacking-155835

  • An easy way to do it would be to use a container with the cart and the other object. Then when the cart is spawned, the other object will automatically spawn with it. Then after the create action, use the scene graph to add the second object as a child to the cart with the appropriate relationships.

    See this example for reference: 1drv.ms/u/s!AkmrWgxeuxlKhIcwi5yQA7k-RzwCWg