...move an object from one point to another

Get help using Construct 2

Post » Mon Dec 31, 2012 7:58 pm

Hi there,

Thanks first of all for the great help so far from everyone! This has really given me a lot of confidence to see this game engine through to make something serious with it.

Now I'm faced with a new challenge that is probably very easy, but its just not clicking for me.

I have an opening scene where i want an object on the bottom edge of the screen come up about 200 pixels and then stop. This can be a straight speed but would be great to have easing in/out.

I can't seem to get what i want. Applying a behavior to the object doesn't work as i'd expect. using bullet might work, but bullet won't let me determine which direction i want it to go, instead it assumes to go right.

8 direction would seem like a good candidate, but it also lacks any way that i can see to send a "move up" command without using the keyboard up arrow, which is not how I need it to be moved.

My thought was to use a system/every tick to take current Y location + 1.. looping this till it reaches the right height..

I'm used to being able to insert X and Y coordinates with variables, but it seems like the properties of objects in Construct 2 only allow numbers so I'm confused how you tell an object where it should be..

All of my efforts are resulting in the object not moving except using Sine, which of course isn't what i'm looking for, but at least it was nice to see it move :)

I saw this thread when searching, but this looks a little too much like coding for what I would imagine is probably pretty easy to do without coding. http://www.scirra.com/forum/using-lerp-and-timedelta-to-move-objects-over-time_topic44418.html


thanks!
Caleb
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 8:01 pm

Set the angle of the bullet for different directions.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Mon Dec 31, 2012 8:06 pm

Let's say your object is at x=0 and y = 300. You need it to move to y=100 and then stop. You COULD use 8-direction like so:

Object.Y > 100
-> Simulate pressing up
(Make sure you set it as custom movement in the properties)

Or you could use bullet like so:

Object.Y <= 100
-> Set Bullet Behavior Disabled
(The reason it wants to go right is because it always "forward". lets say your object is a rocket ship facing upwards, to fix this you need to open the object editor and rotate it 90 degrees clockwise so that the direction it needs to go is facing right, then just set the angle to whatever is needed.)
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Mon Dec 31, 2012 8:13 pm

how to i change the angle? i see:

speed
acceleration
gravity
set angle (yes/no)

there is nothing else that i know of to change this.. set angle sounds good but its just a yes/no condition
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 8:14 pm

i'll try that.. i've never simulated a movement action.. but i'll follow your example and see what i can do! :)
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 8:15 pm

You can rotate it in the editor, just change the angle on the left sidebar.
B
40
S
12
G
7
Posts: 603
Reputation: 7,646

Post » Mon Dec 31, 2012 8:18 pm

In your event sheet..

Sprite -> Bullet Set Angle of Motion.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Mon Dec 31, 2012 8:25 pm

ok i did the editor thing with bullet. that makes sense. I couldn't follow the simulate press up stuff and custom movement.

next it's about figuring out how to do bullet movement for a specific period of time. I see the "every x seconds" but not "for x seconds".
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 8:35 pm

@procrastinator

in the event sheet, you mean i select the sprite in question? when i do that, i don't see a condition "bullet set angle of motion". i have the set angle to yes in the bullet behavior.

for angle conditions i see "is between angles" "is clockwise from" and "is within angle"..

bullet conditions i see are "compare distance traveled" and "compare speed"

thanks,
Caleb
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Post » Mon Dec 31, 2012 8:43 pm

@EncryptedCow

i'm interested in understanding this other approach you're mentioning.. it isn't clear though.. you mention:

Object.Y > 100
-> Simulate pressing up
(Make sure you set it as custom movement in the properties)

where would i put object.y > 100?

i think i follow what you're saying using custom movement, but just not sure how i phrase it to tell the game to move in a direction until the objects y value is greater than 100..
B
51
S
7
G
1
Posts: 869
Reputation: 5,943

Next

Return to How do I....?

Who is online

Users browsing this forum: jeffige and 30 guests