help me with two sprite follow mouse alternately

Get help using Construct 2

Post » Tue Jun 05, 2012 7:24 am

Hi im very new on game development and need help for my problem here..

i have two sprite object and i want them follow and move with mouse and also facing the mouse angle if i press left click.. but i want the sprite moving one by one depend on which one i click the sprite object, as an example if i left click "sprite1" and the other "sprite2" remain and not effected even if both sprite on very near position or very close..

can anyone help me with this.. i almost had a headache try to solve this

sorry for my bad english
B
5
Posts: 10
Reputation: 545

Post » Tue Jun 05, 2012 11:03 am

Hi, stev. I'm guessing you would want to put a selected variable in the sprite? For example, sprite1.selected = 1 when on mouse/touch. Then, register the position and move your selected sprite to it. Cheers.
B
4
Posts: 11
Reputation: 322

Post » Tue Jun 05, 2012 11:40 am

@RockyCake HI thanks for ur replay

can you tell me where to input the variable is on global variable or sprite variable? where i can learn about the variable expression?

im very confuse with the variable system..
B
5
Posts: 10
Reputation: 545

Post » Tue Jun 05, 2012 12:00 pm

Hello, no problem! Anyways, your sprites have a component called 'Instance variables' properties, its just above the behavior properties.
Click add/edit and it will pop out a window. Add a new variable on it and that's pretty much about it.

here is the link for more info. http://www.scirra.com/manual/73/instance-variables/page-1
B
4
Posts: 11
Reputation: 322

Post » Tue Jun 05, 2012 1:05 pm

ok im starting to understand now..

i've read this tuts and understand a bit
http://www.scirra.com/tutorials/158/veryvariable-toggle-between-two-states

but how i able to set different value in variable to a multiple sprite say it 3 object player with only same move like "left click"

example i want a "ball_sprite1" from original position out of layout when i press left click -> move to "player1" position (x,y) then release click it back to original position and if i press same left click to the other "player2" i want the same "ball_sprite1" to move to position (x,y) of "player2" to.. i mean how i able to order the system if i got only one same action is the "left click" action

sorry if i ask a lot & write with the wrong word / grammar..
    stev032012-06-05 13:12:13
B
5
Posts: 10
Reputation: 545

Post » Tue Jun 05, 2012 7:45 pm

OKKK i finally manage with variable THANKs! @RockyCake   

i finally understand using the variable thank's and my problem is solve

need extra tweaking for diffrent value like 1 or 2 and global variable also i dunno if any other methode but im using two dummy sprite ball with same shape and colour and global variable set to 0

i think im begin to love this software.. this is my first for creating a game but scirra make it in simple & nice way for a game programing awesome thanks guys
B
5
Posts: 10
Reputation: 545


Return to How do I....?

Who is online

Users browsing this forum: Kagubro and 26 guests