How can I make and actor repeat and action with out using spawn?

jobeijobei Member Posts: 39
edited July 2012 in Working with GS (Mac)
I'm having trouble with this one, I have done this a few different ways, but it not coming out the way I want it.

In my game I have a item menu at the bottom of my screen, and each item have it's own icon with an visible hitbox over top of them. So when a player want to use and item he/she will touch the icon with the visible hitbox over top and something will appear on the screen.

Now I have it set up , when you touch on the visible hitbox the background turn into and Invert color then I use "interpolate " to fade the background back to normal again, but i want to be able to repeat this over and over again.

I try using spawn, but the hitbox I'm using is small , so when I touch on the visible hitbox it to trigger a small invert box to appear and fade away. I need the spawning actor to take up the whole screen but the hitbox to trigger the actor have to be small at the same time. (I hope you get what I'm trying to say)

This is what I have now, but it only work when i touch on it one time.

Actor - Hitbox

Rule:
Touch is pressed

do:
Change attribute set: game.hitbox big NI
to: True


Actor - Invert backround

Rule:
If game.hitbox big NI is ture

do:
Change Image Set image to: Invert background

Interpolate self.color. alpha
to: 0
for: 6
ease in/out


Like I said this code work one time, after that when i touch the hitbox nothing happen, I need it to repeat over and over
again.
Can anyone help.

Sorry if it kinda hard for you to understand.

Best Answer

  • gyroscopegyroscope I am here.Posts: 6,598
    edited July 2012 Accepted Answer

    Hi @jobei,

    To make an image fade into another image, you need both images already on-screen. (The way you've been trying is similar to if you just want the image to change when pressed, and change back on release, without any fading involved.)

    I'm thinking there a couple of ways to achieve what you're after; one way would be:

    Make sure you're inverted background actor is alpha 0 and over the top of the first actor on-screen.

    Rule:
    When Touch is pressed

    Rule: When self.Color.Alpha < 1 and > 0 ---put this Rule inside the first one

    Change attribute self.Color.Alpha to 1

    Interpolate self.color. alpha to 0 for .6 seconds

    althernatively, put the interpolate behaviourin a When touch is released Rule, if you prefer that sort of behaviour.

    Another experiment to see which you prefer: don't add the 2nd rule, and put the Change Att. and Int. behaviours in the first Touch rule only.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

Answers

  • jobeijobei Member Posts: 39

    Hi @jobei,

    To make an image fade into another image, you need both images already on-screen. (The way you've been trying is similar to if you just want the image to change when pressed, and change

    back on release, without any fading involved.)

    I'm thinking there a couple of ways to achieve what you're after; one way would be:

    Make sure you're inverted background actor is alpha 0 and over the top of the first actor on-screen.

    Rule:
    When Touch is pressed

    Rule: When self.Color.Alpha < 1 and > 0 ---put this Rule inside the first one

    Change attribute self.Color.Alpha to 1

    Interpolate self.color. alpha to 0 for .6 seconds

    althernatively, put the interpolate behaviourin a When touch is released Rule, if you prefer that sort of behaviour.

    Another experiment to see which you prefer: don't add the 2nd rule, and put the Change Att. and Int. behaviours in the first Touch rule only.</blockquot


    I think i have what you put down right, but it still don't repeat. when I touch on the hitbox it still only play once. I want it were I can tap on it over and over again and the invert background pops up and fade away.

Sign In or Register to comment.