Anyone know a way to do opacity effects?

synthesissynthesis Member Posts: 1,693
edited November -1 in Working with GS (Mac)
For example,
You have a cookie on the screen. The gamer taps the cookie and a bite is taken out at the location of the tap using an opacity overlay (which basically masks the image).

In Flash...you would use a mask layer...its pretty simple there.

I am wondering if GS has a way to accomplish this. I have played around with the available graphics settings and have not gotten anything working like this.

Is it possible to achieve this in GS or not? If so, how? If not...it sure would be nice to have.

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    Not possible at the current time..
    You'll need to make separate images for each frame of the sequence.

    I agree that masks would be nice!
  • rebumprebump Member Posts: 1,058
    Not really. Upon touch, compare the touch X/Y with the cookie center X/Y to determine bite section/quadrant/whatever, then change the image to show appropriate bite image.

    If allowing more than one bite, maybe then test for which image is currently in play and then select a newer bite image.

    If you allowed bites in four quadrants, name your images something like:

    cookie_1_1_1_1.png
    cookie_1_1_1_0.png
    .
    .
    .

    And then use string concatenation to "select" the newer image based on the current image.

    The problem here is large rule sets and also if the cookie is rotating or not to determine "bite" quadrant/location (more maths). Also, if you already have a bite in quadrant 4 you would have to ignore (more rules).

    If you don't care where the bite shows up on the cookie in relation to touch, this gets easier.

    Something along those lines...this was hastily thought up.
  • synthesissynthesis Member Posts: 1,693
    I knew of this workaround rebump...but it would be very "static" in execution...I was looking for something more "dynamic" that was more user driven.

    It seems like the "Additive" setting is nearly there. It doesn't seem like it would be a stretch to offer an "Opacity" adjustment that is connected to scene layers (similar to spawning settings). Their "Opaque" setting doesn't seem to offer anything valuable to graphics manipulation.
  • rebumprebump Member Posts: 1,058
    If you won't have too many cookies...each piece of the cookie be a separate actor all constrained together with appropriate offsets.

    I'm using approximately 100 constrains in my current project (with simple graphics) and it performs adequately on a 3GS. It functions on the lesser models, but the timing of execution with timers gets funked up and not all rules fire...so not playable. Anyway, with a four part cookie, that is 25 cookies...scale it down to 10-15 to have a lot of overhead...
  • netdzynrnetdzynr Member Posts: 296
    Here's an alternate suggestion. If you can manage a solid color background in your app, you can create a "bite" actor (the negative space created by "teeth") that is the same color as the background. When the player presses on some location on the cookie, spawn a bite actor in that location (ideally with the appropriate rotation). Since the "bite" is the same color as the background, the result will look like a portion of the cookie has disappeared. If you overlay a bunch of "bites" eventually the cookie will be "gone".
  • synthesissynthesis Member Posts: 1,693
    Good workaround netdznr and it would work well in some cases...but if you want an "interesting" backdrop behind the cookie (eg. a tablecloth)...its a no go. Still looking here for the "perfectly poetic" solution.

    Thanks though for the excellent base solution...I hadn't thought of spawning an "opacity block".
  • rebumprebump Member Posts: 1,058
    My most recent post above this one was similar to what netdzynr suggested in terms of constraining multiple pieces together. So you could use his overlay/mask method taking into consideration the constrain performance info presented above.
  • synthesissynthesis Member Posts: 1,693
    This is a tough one...not sure if we can do it within the preset GS framework.

    HELP US OUT GENDAI...LET'S IMPLEMENT OPACITY EFFECTS ALONGSIDE ADDITIVE EFFECTS!!!
Sign In or Register to comment.