nimos100's Forum Posts

  • [quote:1301ywbs]That's wonderful if I want to do something "Every Tick". I don't want to do it every tick, I want to do it only 90 times and USING A LOOP INSIDE OF A CONDITION BEING MET. That is the topic of my entire post. I want to know how to structure it.

    I am basically asking everyone "Can a loop be executed inside of a condition being met?"

    I don't want to use a behavior, I don't want to call a function (tried both of those still couldn't). I simply want to know how to structure a loop that fires off only once a condition is met.

    Yeah you can run a loop if conditions are made, but what you are trying to do, is not possible the way you want to do it. Because a loop is not based on the time scale you are aiming for. To make what you are trying to do work, you would need to know how fast the loop is executed, as I understand you. Which would be near impossible to figure out as I see it.

  • Here is an example, that will rotate it 90 degree every 1 second, when you click the object.

    https://dl.dropboxusercontent.com/u/109921357/Rotate_test.capx

  • This works while the condition (Mouse On any Click) is Toggled to Disabled.

    Once I Toggle the condition to Enabled (not crossed through) it only moves 1 time not 90.

    What am I doing wrong here?

    The reason it doesn't work is because it not really a valid way of using the events. You repeat it 90 times every tick. But afterwards you have added a Wait 0.3 so even though it runs 90 times, it gets stuck at the 0.3, so you could change it to repeat 1 time, and it would be the same. The amount of times you repeat it are way faster than 0.3 second of wait time.

    The way you want to do it in your code is not based on a 1 second interval, but just on a random amount of time. The reason mine work is because its based on C2 running 60 ticks a second, Which means that it will run through your event sheet 60 times in a second.

    So dividing 90 degree with the 60 ticks, will tell C2 to rotate the object 1.5 degree every tick. And therefore after 1 second it will be 90 degree.

    In you example, try to change the repeat to an

    "Every tick"

    And remove the wait and move the rotate up, and type 90/60 as how much it should rotate, it will make it rotate 90 degree every 1 sec.

    "Every tick"

    Rotate object 90/60 degree.

  • It will use the ticks iteration of 60 automatically.

    What you can do is add a Boolean variable to the objects that you need to rotate, called "Rotating"

    In the event that rotate.

    Object.Rotating true

    Object.rotate clockwise = 90 / 60

    And then you set it to false again when its done rotating.

  • What you can do if you add it to a function is simple call the function with a random number. And based on that it will change the color.

    Input: Random number from 1 to 5

    On Function Change_Color

    If Function.parameter(0) = 1

    Set background color to Red

    If function.parameter(0) = 2

    Set background color to Blue

    etc.

    When you call the function you simply write.

    Call Change_color

    Parameter (0): int(random(5)+1)

    If you are not sure how to use functions, here is a small guide I wrote, They are fairly easy to use and a absolute must to learn if you want to make anything decent in my opinion - https://www.scirra.com/forum/viewtopic.php?t=97305&p=743528#p743528

  • A way you can do it I think, is to make a search bot kind of thingy like a google bot, in form of a check object. So if you add an object called "Checker". Which only purpose is to check each target to see if they are reachable and make the checker invisible, it should just run in the background.

    Then to the enemies you add a Boolean variable called "Reachable".

    As the checker goes through each enemy you changes this variable to either true or false. So if "Checker" found path to enemy you set "Reachable" to true, if it fails you set it to false.

    To your other objects, you can use the same code as you do now, but just add that it should only check enemies where "Reachable" is true.

  • I think you have to be a lot more specific, in what the problem is

    It sounds like you need someone to explain it from start to end, which would take several pages and then it might not even be as you wanted.

  • You have two actions for rotating objects.

    Rotate Clockwise

    Rotate Counter-clockwise

    They are under the Angle section in the action menu.

  • Not sure why you use an array?.

    You can do it like this without the array:

    Event:

    Set layer background color

    Layer: The name of the layer you want to change color.

    Color: RGB(int(random(255)), int(random(255)), int(random(255)))

    You can just put it in a function and call it every time you have to change background color.

    Also you have to make sure that the Layer properties are set correctly.

    Transparent = No

    Opacity = 100

  • Since C2 runs 60 ticks every second. You have to divide the amount of degree you want to rotate every second with that. You don't need a loop you can just do it every tick.

    Action:

    Rotate <Something> clockwise = 90 / 60

    Will rotate it 90 degree every 1 second.

    Rotate <Something> clockwise = 180 / 60

    Will rotate it 180 degree every 1 second etc.

  • You should be able to do it with a pin behaviour, If you enable it every time the player drag the board and disable it again when they don't.

  • To explain picking, you can look at it like a sorting machine.

    Imagine you have 30 different coloured boxes.

    30 - Boxes

    10 - Red boxes

    10 - Blue boxes

    10 - Green boxes

    Pick all boxes - (Will pick 30 boxes)

    Pick Red boxes - (Will pick 10)

    and so on.

    Imagine that each of these boxes have a variable that hold a number from 1 to 3, which are random for all the boxes no matter what color they have.

    If you have an event like this.

    Pick all boxes who have a value of 1 (Lets assume that it pick 8 boxes)

    --- (Sub event) Boxes need to be red (This will pick all red boxes of those 8, so it might pick 2 boxes.)

    --- (Sub event) Pick all Boxes (Will pick all 30 boxes because it is a system command)

  • Im not sure I understand your question, what exactly do you want converted and into what?

    You have a string that you want to convert into Lvlidx and levelXlocations?

    Can you show an example of a string that you want to convert and what you would like it to look?

  • You can also just use "Pick nearest Enemy to Hero" and use it together with the distance check you already have.

    The reason it picks everyone, is because you haven't told it which "Evil" you want to check the distance to hero. So it just take all of them or a random one, not sure.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If I were you I would try to run your game in Debug mode, and check the timer variable. Compare it to the main event sheet where you say it works.