in Education by
In gamesalad framework I am creating a game in which I have an actor which only moves on x-axis on touch is pressed. But when I move it to x-axis the actor goes away out of the range of the screen. Let me clarify that I am new to gamesalad framework. plz help to solve the problem. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
I'm reading this in two different ways: 1 - when you press your touch controls the actor disappears from the screen 2 - when you press the touch control the actor moves along the x-axis and out of the screen For the sake of argument I'm going to assume that we're talking about number two. What you'll need to do is restrict the actors movement to the boundaries of the current screen. You can do this is two ways with Gamesalad 1 - create an invisible barrier for your actor to collide against 2 - use a behaviour to prevent your actor from going beyond the screen boundary I'll explain both: 1, Invisible barriers What you'll do is create a new actor, and set it to collide with the actor that your controlling. You'll create a few instances of this actor to create a walled area for your actor. Although this works, it's a little cludgy and using additional actors in a scene take a little performance away from your application. 2, using a behaviour In my opinion the better way is to use the given behaviours in Gamesalad itself. To stop the player actor from moving off screen you can use a combination of Rules and the Constrain Attribute behaviour to achieve this. The first thing to know is your screen size; for an iPad I believe it's 1074 along the x-axis. So to stop the actor moving off either side of the screen you'll need to do the following: Open up the player actor the click on the "Create Rule" button on the top right. A new rule window will appear, but default the first dropdown will say "Actor receives event" change this to "Attribute". Next select the attribute to use the rule against, since we're interested in the x-axis we'll want to query that player attribute which will be: (also known as self) > Position > X Select the greater than symbol (">") and then enter the maximum width of the screen minus whatever border value you want, so I'll use 1014 (1024 - 10). Find and drag the Constrain Attribute behaviour into your rule a set the actors X position to 1014. This will stop the actor from going beyond one side of the screen, now copy the rule and amend the settings to that if the actor goes less than, say 10, it will constrain the actors X position to 10. I'd post an image, but alas my Karma isn't large enough right now! Hence the large explanation! Hope this is what you're looking for!

Related questions

0 votes
    What does it mean by message blocking is active on iphone?...
asked Aug 6, 2022 in Technology by Editorial Staff
0 votes
    I'm looking for an easy way to store contact details from a webapp to iPhone contacts. The UX of ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    As it currently stands, this question is not a good fit for our Q&A format. We expect answers to ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    Say I have a Game object with many Player objects (a baseball game). The lineup for each game has ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I am able to store, retrieve, and remove values using NSUserDefaults. I couldn't succeed to find out ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I am able to store, retrieve, and remove values using NSUserDefaults. I couldn't succeed to find out ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I am able to store, retrieve, and remove values using NSUserDefaults. I couldn't succeed to find out ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 27, 2022 in Education by JackTerrance
0 votes
    I have a grouped style UITableView with a HeaderView that is loaded from another .xib. The HeaderView has 4 ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 26, 2022 in Education by JackTerrance
0 votes
    I have an application in which I am storing time values in an array. The time is getting stored ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    So basically this is what I want to do: There's a gap in the x axis between week 27 and week ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jul 3, 2022 in Education by JackTerrance
0 votes
    So I'm trying to make box and whisker plots for my weekly/monthly profit and loss for my sports betting picks for ... gotten me so far And following that here is my code exceldata...
asked Apr 7, 2022 in Education by JackTerrance
0 votes
    I have two lists, same size, one is y_data and one is x_data x_data is a time hh:mm:ss during ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    4. is a key that is used to identify the colours, patterns, or symbols assigned to data series. * OData Series O ... Y - Axis O Legend Select the correct answer from above options...
asked Dec 25, 2021 in Education by JackTerrance
0 votes
    10. Find magnitude and angle made by vector a = 5i+5root3j from x-axis. Also draw the vector Select the correct answer from above options...
asked Nov 30, 2021 in Education by JackTerrance
0 votes
    The probability that the graph of y=16x2+8(a+5)x-7a-5=0, is strictly above the x-axis, If a∈[-20,0] A. 1720 B. 1320 C. 720 D. 320 Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
...