Confused: For Each

1 favourites
  • Hi All,

    I have a button that create an Object on the center of the screen, I can drag them around.

    The thing I'm trying to do is: after I created a bunch of them when the mouse is OVER a specific instance, to control ONLY this instance (whatever I want to do, resize, change opacity, it doesn't matter).

    Mouse |> On mouse wheel up |> Rocks |> DO WHATEVER ACTION HERE

    I want to control only one objects, but it affects ALL the created instances that are on the screen.

    I'm guessing that 'For Each' is the solution but I didn't understand how to make it work, the documents confused me a bit so I came to ask here.

  • Hello, try this:

    For each Object

    -> Cursos is over Object

    -> On mouse Wheel

    --> Action

  • Hello, try this:

    For each Object

    -> Cursos is over Object

    -> On mouse Wheel

    --> Action

    Thanks for the quick reply!

    I tried these 2 ways but nothing happens, no affect at all:

  • OK... so I simplify it (by guessing) because I didn't understand it won't work with sub-events.

    So it works that way:

  • OFF TOPIC QUESTION:

    Now that it works, how can I make it to SCALE because I can only found SET SCALE which won't let me do something like: SELF + 5

    The current Width and Height ratio are not best with non 1:1 size objects, so I must use scale.

    Any suggestions?

  • I created a test here and actually you don`t need the for each..

    Look..

    prntscr.com/oz4cy3

  • NICE! That's even better thanks klabundee !

    I tried few tests before and it affect either ALL the rocks or none.

    Can you help me solve the SCALE question related I asked above?

    I want to scale it within the same ratio, so the the width and height are not doing the job...

    Thanks ahead! You Rocks! (got it? rocks... nevermind) :D

  • NICE! That's even better thanks klabundee !

    I tried few tests before and it affect either ALL the rocks or none.

    Can you help me solve the SCALE question related I asked above?

    I want to scale it within the same ratio, so the the width and height are not doing the job...

    Thanks ahead! You Rocks! (got it? rocks... nevermind) :D

    Im already trying rsrs

    Look what im looking for

    This is not working properly yet but shows what I'm heading

    Im trying to get the ratio between Width and Height, so you can increment the size keeing the aspect ratio..

    Lets see if it will work.

  • Maybe there is a way to use the SCALE but I can only use SET... so I'm not sure.

    Scale is 1:1 ratio so it is the best way to do what I'm trying, the width and height are not perfect with my object ratio.

    Maybe using SCALE with variables... but it's getting confusing for me, I'll do some tests.

  • I think I got it!

    Try it please

  • I tried this, and it WORKS! but... it only affects ONCE...

    I created an Instance Variable for the Rock and called it: "Size"

    It's initial number = 1

    The Problem:

    When I scroll UP for example, it will only SCALE it once, and when I keep scrolling it won't continue.

    As you can see the code is very simple so I hope there's a way to fix the "ONLY ONCE" issue.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, I did it before using set size and got the same, it only scale once

  • Alon

    you have to increase the Size variable. Since it starts at 1, and you don't change the variable, your code will always set the scale to 1.01

    on mouse wheel up, add 0.01 to the Size variable, then set the scale to Size.

  • Alon

    you have to increase the Size variable. Since it starts at 1, and you don't change the variable, your code will always set the scale to 1.01

    on mouse wheel up, add 0.01 to the Size variable, then set the scale to Size.

    Thank you AllanR it works PERFECT!

    If anyone would like to see it visually, here is the code after I followed your solution:

  • You can make it even cleaner - one action:

    Set size to (Self.Width+1, Self.Height+1)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)