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
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
-
tatiang Posts: 11,949
Yep. Once you learn to save an attribute correctly, you can save any attribute you like. If you save a table, you can save multiple attributes (e.g. current level, score, powerups, etc.). In your case, you might save the game.Frame and the game would then restart from there.
Play around with saves and also search for videos that will help you.New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
-
tatiang Posts: 11,949
http://idtech365.internaldrive.com/tutorials/installing-the-gamesalad-viewer-on-your-apple-device/
andNew to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Answers
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
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
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
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.
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
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...
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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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...
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
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
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.