LittleStain's Forum Posts

  • I think you mean something like this:

    On object2 created - object1 add to variable value = object2.value

    On object2 destroyed - object1 subtract from variable value = object2.value

    With multiple objects it would probably be easiest to use the family feature and have the adding event be in a function.

    Maybe using the is on screen - condition, would be an option.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure if I understand correctly, but there's the action add to variable..

  • I guess using replace would be the expression to use:

    replace(src, find, rep)

    Find all occurrences of find in src and replace them with rep.

    So that would be

    system set Stats = replace(Stats, "money", str(money))

  • from the manual:

    https://www.scirra.com/manual/126/system-expressions

    int(x)

    Convert the float or text x to an integer (whole number). If x is text, non-numeric characters are allowed after the number, but not before. For example int("33xx") returns 33, but int("xx33") returns 0.

  • I guess you could use distance(object.x,object.y,object2.x,object2.y)

    This would calculate the distance between imagepoint0 of object1 and imagepoint0 of object2

    if this distance is less than 100, object2 would be within a circle of 100 px around the center of object1

  • I just remembered this topic from some time ago, it might be helpfull to someone:

  • What is the reason for turning off collisions?

    It's kinda impossible to detect something that doesn't exist..

  • It seems like the value X or actually x, doesn't exist.

    Not sure if this value is a variable or just the x-value for a certain object not present on your layout, but there is a reference to this value in your event sheet and the value can not be read by javascript.

  • I guess the best way would be to use the spritefont-object in combination with webgl effects..

  • In the layout-properties you can attach the event-sheet of your choice..

    Another way would be to have a seperate event -sheet for level specific events and on each one include the event-sheet for project-wide events.

  • Ok, so if I understand correctly:

    The events you have set up work the way you'd like to except for certain situations.

    It's seems like you have to add conditions to your events to make sure that the computer does what you want in those situations.

    I think adding an is not overlapping condition to the events pertaining the player box, would take away the unexpected results.

    Next issue would be creating a new event describing what you would like to happen in case the player box is overlapping.

  • You could use another global variable to register if the door is open.

  • To me it would seem like the perfect place to use imagepoints..

    Depending on top hit or kick-leg or whatever, but if you want to know the overlapping area, it can be done.

    I'm assuming the hitboxes are square/rectangular

    Create 4 variables ValueYtop,ValueYbottom,ValueXleft,ValueXright

    If hitbox1 is overlapping hitbox2

    • Hitbox1.BBoxTop > Hitbox2.BBoxTop > ValueYtop = Hitbox2.BBoxTop
    • else > ValueYtop = Hitbox1.BBoxTop

    By comparing the boundingbox left, right and bottom you now get the 4 values of the top(Y), bottom(Y), left(X) and right(X) of the overlapping area.

  • A global variable is global, so it is persistent.

    The actions you perform on the variable are inside event sheets.

    If the "draining" action is not in the event sheet of the new layout it will not be performed.

    So I gues it would just be a case of adding the event and action to the new layout.

  • It's not really a question for this forum, but I don't mind answering.

    This should work:

    • select the shape you'd like to export
    • choose export as png
    • choose selection instead of drawing