Help with a movement behavior plz

Get help using Construct 2

Post » Thu Apr 05, 2012 12:05 am

[QUOTE=Noga] I think it could work, but maybe I just don't know how you exactly want it. Here's an example how I see it, can you explain it on this one?[/QUOTE] there's a place where I can check this capx for R84??
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Thu Apr 05, 2012 4:30 pm

[QUOTE=Guif0DA]there's a place where I can check this capx for R84??[/QUOTE]
I could recreate it in R84, but can't you just install r85? (you can install in on a flash drive, if you wanna keep the stable version)
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Thu Apr 05, 2012 11:28 pm

[QUOTE=Noga] [QUOTE=Guif0DA]there's a place where I can check this capx for R84??[/QUOTE]
I could recreate it in R84, but can't you just install r85? (you can install in on a flash drive, if you wanna keep the stable version) [/QUOTE] Downloaded the R85 to test it and keep the stable version ( I didn't want to remvoe it, but I don't need, didn't know that, sry ;) )

from what I saw of yout capx it's what I'm looking for, ill do some tests if I can implement that in my game and see if works, thanks ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Fri Apr 06, 2012 1:09 am

Unfortunately I can't implement that because of the lack of family behavior support.. so Ill need to wait more..

I had before made some tests and yes, i had obtained the same method as you but now I remember why I didn't used it, because I can't use actions from a behavior for a family.. =(
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Fri Apr 06, 2012 9:49 am

If it's not a big problem, you could workaround the bullet behavior like this.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Mon Apr 09, 2012 3:22 am

I've implemented your method and it's working very well, thanks a lot!

but I have a question, I'm trying to detect if the sprite is moving to the right, it will face to the right, if moving to left, face left, etc.
Is there a way?
before that I was comparing his angle to detect which direction he was facing but now he's always at the same angle so I have no idea how to do that.. I trying the within angle but not sure if it's the right choice..
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Mon Apr 09, 2012 11:47 am

You don't want the sprite to rotate, only face the direction, but how many? 2 - left/right or 4 - left/right/up/down? What if the destination point is diagonally from the sprite? I'll try to make an example.
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Mon Apr 09, 2012 3:23 pm

4 directions

maybe compare his distance of x and y to object??Guif0DA2012-04-09 16:07:32
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Tue Apr 10, 2012 4:52 am

New example

Here's how it works, this picture could also help you.

The sprite has 4 animation frames for 4 possible directions. A frame is chosen on where you click the mouse and the position of the sprite. It's divided into 4 sectors.
frame #0 has sector 315 up to 360 and from 0 to 45
#1 = 45 - 135
#2 = 135 - 225
#3 = 225 - 315

On the bottom part of the picture - the angle between the click of the mouse and the sprite is about 110, so the code selects frame 1 (arrow is pointing up).   
ImageImage
B
25
S
6
G
8
Posts: 773
Reputation: 6,643

Post » Tue Apr 10, 2012 5:20 am

Dude that method u used to calculate his direction is extremely complex hehehe but it works! Somethings u used in the event i have no idea what they are.. like 'floor' and this ">= 315 ? 0 :" part.. but once again thanks!
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Lof, YoHoho and 20 guests