About moving an actor with a single touch to screen

Hi every body. I have a game i created before using only xcode called Be A Star. I was trying to create same game in salad but despite working on it around 3 hours i couldnt solve the problem. What i have done so far create 4 actor. 1 background 3 picture. when app starts running lets say A picture comes from left to right with Change velocity 0 scene 300 then Rule attribute self.position.X > 80 Constrain Att. self.Position.X to 80 . This works fine. after this i put to background actor a Rule that if touch is equals to 1 then spawn an actor to the position. This works great aswell. But after this I returned to picture A and create another rule says if touch equals to 2 then I used the same way that i used for to move right but instead of self.position.x I used seşf.position.Y I thought it will work but it didnt. It just stop like that.

If you want to understand what im trying to do in general you can download my game from app store that will answer your question..

Please someone help me

Best Answers

Answers

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Is this the game? https://itunes.apple.com/us/app/be-a-star/id572411589?mt=8 It's really helpful if you provide a link to the game that you are mentioning.

    In order to know what's not working in your GameSalad project, you'll need to post a screenshot of your rules. The way you've described them gives me a general idea of what you're trying to do, but since those aren't the exact rules, I can't help you yet.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • quique13quique13 Member Posts: 99
    if you want to move an actor with your finger then in the actor that you want to move make a rule that states

    when touch is pressed
    constrain attribute-- (self in the pop up menu is the name of the actor) self position X to device mouse position X

    and do another for Y just replace the X for Y
    and that should let you click the picture and move it around where ever you want

    hope this helps cheers :D
  • Lib87Lib87 Member Posts: 20
    edited December 2012
    Is this the game? https://itunes.apple.com/us/app/be-a-star/id572411589?mt=8 It's really helpful if you provide a link to the game that you are mentioning.

    In order to know what's not working in your GameSalad project, you'll need to post a screenshot of your rules. The way you've described them gives me a general idea of what you're trying to do, but since those aren't the exact rules, I can't help you yet.
    Yes thats my game.

    Well im simply trying to move my actor from point X=0 to x= 10 or 20 doesnt matter. with a touch of the screen anywhere. If you download my game you will see if you touch screen images comes from the right and left side of the screen. As speech bubles that i used the hide and unhide method I find spawn and kill method. The thing is after second touch ( which i spawn the picture to the screen ) it doesnt even deleting it.

    No code working after that spawn ... Maybe its not related with that but this is just what i thought.

    EDIT: I can put a screen shot tomorow. I mean around 1 pm its too late right now
  • Lib87Lib87 Member Posts: 20
    edited December 2012
    http://imageshack.us/photo/my-images/5/27918101513043601837381.jpg/
    http://imageshack.us/photo/my-images/826/29996310151304360293738.jpg/

    here some pictures. If i add same method in green actor as right version nothing happens.

    If i cannot solve this problem there is no point to learn all this program which is going to take a lot time.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2012
    Game Design takes patience. So if it's not for you, it's not for you.

    It's hard for me to understand what you are wanting to do and neither of those rules have a second touch as a condition. But I think you need to at least change the Change Attribute to a Constrain Attribute to get the moving actor to stop.

    Also, I realize that taking a picture with your phone might be easier, but taking a screenshot (shift+command+3 or shift+command+4) allows for much higher quality/clarity.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    Well i told you i want that actor move from right to left automatically first then with a touch to the screen an actor spawn then when user touch the screen again first actore should return to its main position.

    As i told before you can check my game and at the begining micraphone picture comes automatically and then when user touch speech comes then another touch left micraphone picture gone again and so on...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Touch count is based on the number of unique touches (e.g. fingers) on the screen. I think what you need to do is have a rule that says When mouse is down, change attribute game.NumberOfTaps (index type) to game.NumberOfTaps+1 and then check to see if game.NumberOfTaps is 2.

    Or are you wanting it to respond only when the player touches the screen with multiple fingers?

    If you'd like more help, zip your project file and send me a link to it via private message. If I see the code, I should be able to help you fix it.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    Touch count is based on the number of unique touches (e.g. fingers) on the screen. I think what you need to do is have a rule that says When mouse is down, change attribute game.NumberOfTaps (index type) to game.NumberOfTaps+1 and then check to see if game.NumberOfTaps is 2.

    Or are you wanting it to respond only when the player touches the screen with multiple fingers?

    If you'd like more help, zip your project file and send me a link to it via private message. If I see the code, I should be able to help you fix it.
    No exactly like you said when user touch the screen an action happen when they touch again something else happen again and so on.. Only with one figer not multiple. + If i chose mouse touch does it mean also finger touch ?
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Yes. When Mouse button is down means when the mouse is clicked or when the screen is tapped anywhere. When Touch is pressed means when the mouse is clicked or when the screen is tapped ON the actor.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    So there is no difference when we are creating a game and say mause click or touch the screen. Both are the same.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    So there is no difference when we are creating a game and say mause click or touch the screen. Both are the same.
    There is no difference. When Mouse is Down and When Touch is Pressed have the exact same effect when you click or tap on an actor. However, as I said above, Touch is Pressed means that you are clicking/tapping on the actor itself while Mouse is Down means that you are clicking/tapping anywhere on the scene.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    So there is no difference when we are creating a game and say mause click or touch the screen. Both are the same.
    There is no difference. When Mouse is Down and When Touch is Pressed have the exact same effect when you click or tap on an actor. However, as I said above, Touch is Pressed means that you are clicking/tapping on the actor itself while Mouse is Down means that you are clicking/tapping anywhere on the scene.
    Ok thank you. It make it a bit clear but still couldnt solve my problem I will write my coding to here from Xcode so you can check it out for me
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    You're asking how to do something quite simple. I don't think you need to pull out the Xcode syntax to do it. When I played your game, I saw that if you tap on the screen, new text appears and/or the actor disappears or is replaced by another actor.

    You might try this:

    Create a game attribute called game.Frame (type index) and start it at 0.
    Have an actor on the scene that has the rule When Mouse button is Down --> Change Attribute game.Frame to game.Frame+1. You can hide this actor by adding the behavior Change Attribute self.color.alpha.

    Then, on each actor that appears/disappears:
    When game.Frame=[my entry frame number*] --> Interpolate self.position.X to [on screen location]
    When game.Frame=[my exit frame number] --> Interpolate self.position.X to [off-screen location]


    *If you want actor A to appear on the first frame and leave on the 5th frame, then actor A's entry frame number is 1 and exit frame number is 5.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Here's a demo. Just click/tap the screen to increase the frame number shown at the bottom... the two actors will appear and disappear accordingly.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    You are amazing :) I didnt try the way you describe but Im very veryy i mean very thankful to you that you actually bother to answer me all the time. I must say im impressed. Thank you for your help.

    The reason that I want to get to game salad that im gonna create my game(That you played) in game salad and add a method that can save the game state bcz i couldnt make it in xcode that can save the state of the game. When the game crashes then players can play from the last saved file.

    Right now When it crash it starts from begining. Im not that professional to solve the problem yet...
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited December 2012
    You're welcome! There are videos that explain how to save attributes and tables. Here's one example, but you can search for others:

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Lib87Lib87 Member Posts: 20
    But this shows how to save attributes like high score i want to actually need to save game condition in case if game crash then user can continue from whereever they left
  • Lib87Lib87 Member Posts: 20
    edited December 2012
    EDIT: Sorry my mistake This is exactly what i need but between each move i need to spawn and destroy an actor to show some speech. Can I do an array in here for speech instead of putting all the speeches with different bubbles.

    EDIT2: Instead of spawning (which didnt work i dont know why) I create another actor and move it from top to bottom direction in 0.01 sec so its like apearing and this apearing. Now I need to create save attribute thingy and try it in my iphone
  • Lib87Lib87 Member Posts: 20
    How can i test the app in my Iphone through gamesalad ?
  • Lib87Lib87 Member Posts: 20
    Thank you now i test it in my device but It turns all the screens when you turn the device right or left.
  • Lib87Lib87 Member Posts: 20
    Ok here i come again. I have few more problem. First of all I watched few video on youtube and try one it didnt work. When i use same coding or way it didnt even move.... Second thing is i create another page which i was hoping when i go that page and return my game will be restart but it doesnt.

    Now how can i understand it is saving or not? I mean probably it isnt saving but how can i check that if application crash it will start from the begining or not.
Sign In or Register to comment.