calminthenight's Forum Posts

  • Firstly try using int(random(0,999)) rather than round. The last image in your gallery "code woes" doesn't display. It is easier to get help if you post a link to your project file so people can open it up and have a look :)

  • From my experience, as you mentioned, using overlays/masks is always heavy on the GPU. If you can avoid any overlapping sprites with transparency and bake it in to the scene it helps a bunch. Otherwise there is the option of low fullscreen quality which may or may not work depending on your content.

    From the manual: > "This only applies when the viewport is being stretched (i.e. Fullscreen mode is not Off). High quality mode renders at the full resolution of the displayed size. Low quality mode first renders at the project viewport size, and then simply stretches the result to fill the screen. Low quality mode often improves performance on low-end systems and is often suitable for retro-style pixellated games with Point sampling. However note that text, downscaled sprites and effects will appear with better detail in high quality mode."

    Having the viewport size/scale set at the appropriate amount will also help. For example if your project is set to 1920x1080 and the window size is smaller than that and requires down-scaling, in my experience that eats a lot of FPS. I'm not sure how it works with upscaling but if your project is set at 1366x768 and is being displayed on a 1080p device I imagine that also has a detrimental effect on FPS.

    EDIT: also this thread talks about using "pre-load images" and then if you are going to create any images at runtime, have them positioned offscreen first and then destroyed at startup. construct.net/en/forum/construct-3/how-do-i-8/preload-images-sprites-appear-145016

  • 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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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]