nimos100's Recent Forum Activity

  • Hey

    I ran into a problem that i hope someone can help me with.

    I have a family called buildings, which contain different types of buildings.

    I would like to reduce one of the variable for all buildings, but i cant seem to get it to work.

    Lets say i wanted to reduce A by 10% for all buildings.

    How do you change it for all of them? i have tried to use pick all buildings, and for each building but doesnt seem to have any effect.

  • "So, closing as not a bug I'm afraid... "

    Thats only good :)

    And thanks for the explaination.

  • Hi not sure if its a bug or maybe i just misunderstood something, so hope someone can help me.

    I have an event that is triggered by "On created" as part of its actions i have it spawn another object which angle i change to 90. The spawned object have custom movement behaviour on it. So after i have changed it angle to 90, i set angle of motion so it matches the spawned object angle.

    In another event i then tell it to accelerate 50 forward, which makes the object go toward 0 degree instead of 90.

    However if i move the action "Angle of motion = object.angle" to another event and add an acceleration action as well. it moves the correct way.

    I also tried adding "Angle of motion" and set its "angle of motion" to the newly spawned object angle together with an "Accelerate" action in the "On created" event. And it still moves towards 0 and not 90.

    It seems to me that if you use the "spawn another object" and custom movement in the same event there are some problems, or maybe im doing something wrong.

    Anyway im not sure if its a bug or not, can someone confirm it or maybe explain what im doing wrong?

    Heres a link to a test:

    Test custom movement

    Thanks

  • Sorry dont know how to do that.

    Maybe an alternativ would be to give each function an index of some sort and then instead of using an array to store them you just make them as events with a build in wait function, so "the script" would be a list of numbers corresponding to the functions the player typed.

    "the script(1,3,2)"

    1 = move

    2 = something else

    3 = etc

    And then you just fire of the script when the player is done entering functions.

  • Hy, I have a loop that will go over an array(1d, width:10) and after every cycle I want the loop to wait 1 second in order to execute my animation. Well, it looks like the wait action doesn't work in a loop, any ideas?

    Cant you just make a global variable or instance variable called "Cycle_ready" or whatever :)

    And then you make a event with condition "every 1 sec"/"every tick" and a bool that checks if "Cycle_ready = true" and then as an action in that event you set "Cycle_ready" to false.

    After that you make another event with condition "animation finished" or whats it called and set "Cycle_ready = true" if the animation takes 1 sec.

  • It shouldn't be necessary to make the angle be in the range of [0,360). Using just Angle(X1,Y1,X2,Y2) should be enough. You might be right, I just couldnt get it to work correctly. If you have two object:           y->      x-> (-> = object.Angle) Angle(x1,y1,x2,y2) give you the angle in degree between X and Y, in this case lets say its around 40 degree, then Angle will return -40 degree, since X is below Y and we put X as the x1, y1, and Y as x2,y2. Let say i wanted to check if X angle was within 10 degree of Y, when X is rotated. So after rotating X with "Set angle towards" so its pointing at Y, X.Angle would be around 320 degree since its calculated clockwise, so it will never be within 10 degree of Angle(x1,y1,x2,y2) which is -40 degree. If you use the above math instead (360 + Angle(x1,y1,x2,y2)% 360)% 360 the degree returned is the same as x.Angle in this case instead of -40 its around 320. And will therefore return true, if you rotate X so its 11 degree of pointing at Y you will get a false, when we assume that the we want to check if its within 10 degree.

  • Hi

    After spending several hours trying to figure out how to check if one object is within a certain angle limit of another object. I finally found a solution, and thought i would share it here as i could imagine others might run into the same problem.

    To quickly explain where I ran into the problem, and so its easier to understand what im talking about. I am working on a tower defence game, and i made a simple tower that track the closest enemy as they come within range. To make sure that the tower doesnt shoot before its actually aiming at an enemy, i wanted to test if an enemy was within 15 degree of the towers cannon angle.

    Since Angle(X1,Y1,X2,Y2) return a value in degree between the 2 objects, and the tower cannon angle is an clockwise degree value (think thats correct <img src="smileys/smiley9.gif" border="0" align="middle">). I ran into problems with towers not wanting to shoot, based on where they were placed in comparison to the enemy. Hope it make sense so far <img src="smileys/smiley36.gif" border="0" align="middle"> as im not really good at these math things.)

    And therefore the credit of this doesnt go to me, im just sharing information, and i wont be able to explain exactly what it means, but I will link to the original page in the end for those that want to know the details.

    However to implement it in construct 2 you can do the following:

    To the object that need to have a limited angle of firing (My case cannon):

    • Add "is within angle" conditions.
    • In the "within" field add your limit.
    • In the "Angle" field you add:

    (360 + Angle(X1,Y1,X2,Y2)% 360)% 360

    (As far as i understand it, it will make sure that the Angle(X1,Y1,X2,Y2) result will always be in positiv degree from [0 to 360], matching return value of the object.Angle that you want to test.....however might be completely wrong <img src="smileys/smiley4.gif" border="0" align="middle">)

    Source: Is an angle between two other angles?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • The cursor can be over two objects at once. If you only want to modify one, you might want to add a 'pick topmost' condition to pick the top object the cursor is over.

    That was exactly what i needed <img src="smileys/smiley32.gif" border="0" align="middle" />

  • I did some testing with that, and i think i can get it working by careful adjusting the collision polygons.

    Thanks for that :D

  • Hi

    Im pretty new to Construct 2, so hope someone can help me with this probably fairly easy question about cursor over <img src="smileys/smiley1.gif" border="0" align="middle" />

    I have made a game where if you hold the cursor over an object and press a key it changes to another object. Which is working fine.

    My problem is if the objects are close together (not overlapping) and you have the cursor on the edge of one objects and press the key it will change both objects.

    Is there a way to only change the one where the cursor is most overlapping. Or is there some other way to do this?

nimos100's avatar

nimos100

Member since 23 Sep, 2012

None one is following nimos100 yet!

Trophy Case

  • 12-Year Club
  • Coach One of your tutorials has over 1,000 readers
  • Educator One of your tutorials has over 10,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

16/44
How to earn trophies