how to make items fall from the top of a screen

taytay10taytay10 Member Posts: 66
edited November -1 in Working with GS (Mac)
Hello I have a question. How would I make a image fall from the top of the screen and disappear when it hits the bottom of the screen? Also would i be able to hide images behind another image (ie. a cloud) and then have the the image of raindrops fall after they reach the bottom on the cloud? If you know how to do this it would be greatly apreciated. Thanks in Advance!

Comments

  • You could create a actor that spawns other actors using the "Spawn Actor" behaviour. Then have a actor at the bottom of the screen and make it so when your spawned actor collides with the actor at the bottom it destroys its self using the "Destroy" behaviour.
    Sorry if that doesn't make sense i'm not the best at explaining things.

    Edit: You can make actors invisible so they can hide anywhere.

    Eight Bit Remix
  • taytay10taytay10 Member Posts: 66
    No I kinda of understand what you are talking about. But is it possible to hide it first and then have it appear as it is falling down the screen?
  • tenrdrmertenrdrmer Member, Sous Chef, Senior Sous-Chef Posts: 9,934
    you can place actors in an area above the scene and set them to move to a lower y position or use interpolate to move their y position
  • azavegaazavega Member Posts: 362
    sure you just change the alpha attribute on the actor... i gues you can use interpolate so it goes increasing on visibility till it reach the value of 1 that is visible...
  • taytay10taytay10 Member Posts: 66
    Can you give me an example as the steps to come to that conclusion? I am new to gamesalad and just trying to figure out all the actions etc.
  • msonesmsones Inactive, Chef Emeritus Posts: 75
    Taytay,

    Check out this video on recycling actors:



    You could easily have a rule that tells the raindrops, when they reach a particular Y level on the screen, to change their alpha from 0 to 1, and when they hit a second Y (probably set to 0 or -1) on the screen, change their position to be back at the top again.

    To be more clear:

    Place your raindrop actors behind your cloud or above the top of the visible screen.
    Set their alpha to 0.
    Create a rule that when self.position.y=height of your scene, change attribute Alpha to 1. (an iPhone screen is 320x480, so depending upon whether you are using landscape or portrait mode, one of those numbers is probably the height of your screen)

    If dropping from behind a cloud, simply make the y position the bottom edge of the cloud - might take some messing around here to get the exact right location. However, if you're starting behind the cloud, they may not need to be invisible in the first place - depends upon the opacity of the cloud.

    Then - create another rule on the raindrops that says "when self.position.y=0, change attribute self.position.y to 330" (or another value that will place it above the top of the screen, or behind the cloud).

    I am assuming you have gravity on the scene; if not, you'll also need a constant downward velocity or acceleration.

    I hope that helps!
  • azavegaazavega Member Posts: 362
    ok never use it but this is how i think it works.. somebody corrects me if i'm wrong...
    The actor you want to appear have to have alpha color set to 0 the when you spawn the actor use a boolean attribute to recognize the spawn... then this actor have to get a rule if spawn=true then interpolate self.color.alpha to 1 and that give you the effect... i think

    @msones you got it first lol
  • taytay10taytay10 Member Posts: 66
    okay how would i set the gravity or acceleration also.
  • azavegaazavega Member Posts: 362
    to set gravity you have to go to scene and change the value on gravity on X or Y depends of your game orientation... aceleration its just a behavior on the actor
Sign In or Register to comment.