GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

I think I have bumped my head....

KhestralKhestral Posts: 8Member
edited November -1 in Working with GS (Mac)
I cannot for some reason figure out how to do a simple game like catch dropping fruit in a basket...

Is there some examples of this type of thing out there? I seem to be unable to find the if they are.

Thanks!!!

Comments

  • quantumsheepquantumsheep Posts: 8,188Member
    Ok, I'm going to do this for you, but you really should just try things out as you'll learn a hell of a lot from doing so! ;)

    Let's set the score attribute.

    When you open up GameSalad, above the actor pane on the left you will see three tabs; Actors, Attributes and Devices

    Click on attributes and click the + symbol in the bottom left of the window.

    Choose 'integer' and then re-name the new attribute 'Score'

    Now click the 'Actors' tab at the top to take you back to the actors tab.

    You need to make four actors.

    The first actor is your player, in this case a basket. (basket case?)

    Name the actor 'basket'.

    Add a basket image into the 'images' section and drag this up to the actor.

    Double click the actor and make the image the size you want (the size value on the left hand pane)

    Add a rule saying 'if attribute changes' - key - is left

    Then into this rule drag a 'Move' behaviour. Set the direction 180 relative to actor

    Set the speed to what you want (90 is reasonable).

    Create another rule saying 'if attribute changes' - key - is right

    Into this rule drag a 'Move' behaviour. Set the direction 0 relative to actor

    Set speed the same as before.

    These two rules are your left and right movement.

    Now onto your second actor. The fruit. Name it 'Fruit'.

    Drag a fruity image into the 'images' section, then drag it from there to your second actor.

    Double click on the fruity actor/

    Add a 'Move' behaviour. Set the direction to 270 relative to actor. Set the speed to whatever you want.

    Create a rule 'Actor receives event' - collides- with instance of type - basket

    Drag a change attribute behaviour to the rule.

    Click on the first 'e' button.

    The attribute browser will appear. Click on Game, then choose Score. It should appear in the change attribute display as game.Score

    Then click on the second 'e' button after To:

    The expression editor will appear. Click on the down arrow. Again, click on game, and choose Score again.
    In the text window above, it should read game.Score. Add a +5 (or whatever you want) after the game.Score text so it reads game.Score+5.

    Click the tick.

    Now add another behaviour, 'Destroy' to the rule.

    This means the fruit will move down, and if it collides with the basket it will disappear and give you 5 points.

    Now we need another new actor.

    Call it 'Dropfruit' and drag a timer into it. Set the timer to 'Every' 5 seconds (or whaterver).

    Then drag a Spawn Actor behaviour into the timer.

    In this behaviour, just change the 'Spawn a new' to 'Fruit'

    Finally, make a new actor. Call this 'Score'

    Drag a 'Display Text' behaviour to this actor.

    Click on the 'e' button and choose Game, then 'Score' as you have done before.

    On the left hand pane, make sure you set the alpha to 0. You can find this setting under 'colour'.

    Now, go back to your scene.

    Drag the basket actor to somewhere along the bottom of the screen.

    Drag the 'Dropfruit' Actor to somewhere along the top of the screen.

    Put the score somewhere (top right maybe).

    Play your game!

    Hope that helps,

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: http://www.quantum-sheep.com

  • JGary321JGary321 Posts: 1,246Member
    Hey QS can you tell me how to make a tower defense game? Step by step bro. Maybe put in some graphics too. Then send me the GS game file, so I can make an iPhone app out of it.

    =)

    -JGary
  • quantumsheepquantumsheep Posts: 8,188Member
    Have you bumped your head though?

    If you haven't, I can't help. If you have, I told you last week. Have you forgotten? ;)

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: http://www.quantum-sheep.com

  • JGary321JGary321 Posts: 1,246Member
    I bumped my head, so how could I remember what happened last week??
  • quantumsheepquantumsheep Posts: 8,188Member
    Exactly!

    MUAHAHAHAHA etc etc

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: http://www.quantum-sheep.com

  • JGary321JGary321 Posts: 1,246Member
    This thread has offical been Hijacked!
  • butterbeanbutterbean Posts: 4,315Member, PRO
    Yeah Quantum, I have a few ideas on games too, so can you send me a full instruction sheet on how to create it, I'll make sure to mention you in there when I export it to Apple :)

    In fact, just compress your game files and send em' on over here please, be a good lil' sous chef :)
  • JGary321JGary321 Posts: 1,246Member
    Sorry QS, 2 against one. Pony up.
  • danreldanrel Posts: 28Member
    Hey QS,

    I'll create your graphics for free if you create my game for me(sans-images)

    What say yey?

    :)
  • danreldanrel Posts: 28Member
    BTW- It's three against one now!
  • quantumsheepquantumsheep Posts: 8,188Member
    I'd love to help you all!!!*

    *but I won't ;)

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: http://www.quantum-sheep.com

  • KhestralKhestral Posts: 8Member
    OK OK message received :D

    Sorry for asking like that but I was frustrated and I couldn't find what I was looking for :D I am seriously new to all this and I'm trying to make a game for my daughter... Thanks a ton for the info and next time I promise to do more detective work!

    Thanks again!
  • JGary321JGary321 Posts: 1,246Member
    Hey Khestral,

    We weren't disrespecting you by any means. You have to understand that we are a very light-hearted group here. We joke & have fun. If you felt disrespected or thought we were poking fun at you, that was not the case. We were actually poking fun at Quantum, for giving such a detailed response. So sorry if it came across in any other way!

    -JGary

    Purple Alligators
  • quantumsheepquantumsheep Posts: 8,188Member
    Speak for yourself!

    Ahahahahaha! *choke* :P

    Khestral, I hope your daughter enjoys her game!

    As for you, JGary, I see your Purple Alligators and raise you an Albino Blue Whale!

    QS

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: http://www.quantum-sheep.com

  • JGary321JGary321 Posts: 1,246Member
    tou-ché, Time traveling sheep! tou-ché!
  • butterbeanbutterbean Posts: 4,315Member, PRO
    Khestral

    No hard feelings ! I think that's really sweet that you're making a game for your daughter :)

    I think it's great that you asked, we are a very open, and laid back forum, just go and look at all the questions I asked, and you'll feel better :)

    Good luck with your game, and please, if you have any other questions, ask away! It helps those of us who don't know programming like savvy Quantum Sheep over there, and thus, why we harass him nonstop to meet our demands to make games for us :)

    I just don't know why he won't agree to our demands already? Give it up Quantum!
  • KhestralKhestral Posts: 8Member
    Ok so I got most of it working except the fruit that spawns does not drop down the screen... it spawns and then sits there. I followed the directions to the tee :D

    I love the openness trust me... I am coder deficient so i know I ask some goofy questions :D Trust me no disrespect felt here :D
  • butterbeanbutterbean Posts: 4,315Member, PRO
    Did you change the physics on the actor to check the box: Moveable?

    What I did was created a separate invisible actor called: Spawn "name of actor" and placed it onto the screen, and added a timer, and location of spawn (this is otherwise known as an actor controller, and the player can't see it, but it controls elements in the game like score, spawning of actors, etc)

    Then the "actor" itself, in your case, the fruit, you can add the attributes like move: put direction 270 if you want them to fall straight down, and at what speed: 25 and that should work

    You also need other attributes in your fruit actor like bounce, collides rule etc

    Trust me, I am very coder deficient, and it's taken me months to get accustomed to using GS, and I still have questions

    Hope this helps
  • KhestralKhestral Posts: 8Member
    Wow I feel silly now, I had the move attribute tied into a rule so it was making it impossible to actually do the drop :D Now I need to figure out how to move the spawn actor across the screen and drop every X seconds
  • butterbeanbutterbean Posts: 4,315Member, PRO
    So under the spawn actor rule (The invisible one you dragged into the scene) you can place a timer rule, say every .5 seconds

    Spawn actor: "fruit"

    Position : you can place the word Random in there so the fruit drops randomly from the sky (In my case, I put random (10,470) on the arrow facing right ---> and on the arrow facing up: you can put 310 (that way they will start to spawn at the top of the screen.

    If you're tree is lower on the screen, and not at the top, you can play around with those x and y axis numbers depending on where on the screen you want them to spawn :)

    Hope this helps!
  • KhestralKhestral Posts: 8Member
    Butter you own... I got everything working but I have a few more question... If I wanted to drop multiple fruits of different types would I need 1 actor per fruit? If so is there a limit to what I should look out for?

    Also I am having issues with wrapping of actors on the screen, I know this is most likely easy but I was thinking of somehow telling it to not go outside the boundaries... is this possible?
  • butterbeanbutterbean Posts: 4,315Member, PRO
    For myself, because it was the easier way, I created a different actor, and placed another invisible actor controller on the screen, so that a different type of bird would come down from the top of the screen

    So create another invisible game controller, say spawn "apple" and create an actor prototype with the image apple. Same thing for a different type of fruit.

    I think you can also do this another way, but this was much easier for me, and has worked so far!

    Yes, you can tell the actors to stay within the boundaries of the screen.

    What I did was changed the numbers under the position (I think under spawn actor fruit), and under the position, I changed the x position (arrow facing right ---->) to random (10,470) and kept it relative to scene.
    On the y position (arrow facing up), I just put 310 so they spawn just at the top of the screen. Again, you can play around with these numbers until you're satisfied.

    What the x axis numbers (10,470) did was keep the actors from showing up on the borders of the screen, and you can play around with those numbers until you're happy!

    Also, to prevent fruits from dropping over and over, and cycling, once they hit the ground, you can destroy actor so they don't keep reappearning. I'll have to go home and look at how I did this, but you place a coordinate, if y is less than 2, destroy actor, or something to that effect.

    Hope this helps!
  • JGary321JGary321 Posts: 1,246Member
    Just FYI: Pick whichever way is easier. Butterbean has a good way of doing it, you can also have 1 "Actor Controller". To me it's easier, b/c of less clutter. But make sure you name your rules. So you could open the actor controller, then you would have "Apple" & then "Pear" etc... You can also use the Group rule, to put all the 'apple' rules together or all the 'pear' rules together. That way you can keep it organized.

    Just pick whichever works better for you.
  • KhestralKhestral Posts: 8Member
    Could you build 1 rule and then mimic it 26 times with a different image? I am basically trying to get the alphabet to drop and not fruit... fruit was what I was using in the prototype :D
  • butterbeanbutterbean Posts: 4,315Member, PRO
    You could use one actor controller like JGary said, and then put rules in for each letter, as to when to drop them

    OR:

    You can create a game attribute called "game.drop letters" and add rules in there which gets a little more complicated, and would require some learning, and definitely some help from the sous chefs on here

    Wish I could help you more on this!

    Since you require dropping so many letters, there must be an easier way to do this than have to spawn each letter individually, so good luck!
  • JGary321JGary321 Posts: 1,246Member
    I would do it like this: 1 Actor Controller

    If it's based off a set time then:

    Create ACTOR Attribute called "Letter"

    Create rule that every x secs change "Letter" to random (1,26)

    Then a rule that if
    Actor.Letter = 1 spawn actor A
    Actor.Letter = 2 spawn actor B

    etc...

    Create your actor for each letter.

    As far as making random times there was a thread somewhere on here that explained a way to do it. I can't remember that one off hand.

    There is no easy way to do this. None that I'm aware at least.
This discussion has been closed.