How to stop objects from moving?

For questions about using Classic.

Post » Sun Jul 13, 2008 11:27 pm

I know this sounds really dumb but...I'm making a swordfighting system that is controlled with mouse. In order for it to work, the sword should stop moving if it goes over the MouseArea.

However, I'm probably blind or something, I can't find a way to stop the sword from moving :oops:

Can someone help me with this? It's a simple Sprite bound to a Mouse Behaviour.
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Sun Jul 13, 2008 11:32 pm

How about a Distance condition? If mouse is too far from swordsman then you cant swing.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Sun Jul 13, 2008 11:35 pm

[quote="Doppel":2swrrodx]How about a Distance condition? If mouse is too far from swordsman then you cant swing.[/quote:2swrrodx]
Distance? I'm a bit of a newbie with Construct, but yes, that's what I want. That's why I made MouseArea, it's wrapped around the character so that he can't swing across the landscape but only where his hands reach. But I can't for life think of a way to make the sword stop after a distance.

Also there is no pre-baked "swinging", you use the mouse to swing and hold right-click to rotate the blade. The end of the sword has a damage point that's used to see how much damage you do to your enemies.
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Sun Jul 13, 2008 11:45 pm

It depends. How do you move the sword? Is it a built in movement or custom events? If custom events, you could add the number of pixels covered to a private variable, and when this exceeds a value (eg. 100 pixels) stop the movement of the sword.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Sun Jul 13, 2008 11:46 pm

It's movement, but here's the .cap, hopefully explains what I'm after.

http://upload.namelezz.net/downloader.p ... swords.cap
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Mon Jul 14, 2008 11:27 am

OK i modified your cap.
http://www.mediafire.com/?y1xqql0ntx3

Also added one point in MainChar for swordhand to be.
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Tue Jul 15, 2008 1:13 am

Thanks, now it's good.

In other news, I made it have my trademark day/night system implementation - which in turn, caused an unfixable Invalid Texture Referenced error. I filed it into the bug tracker so you could take a look at it Ashley, much appreciated.

Edit: Restarted computer and the .cap worked - can the bug report be deleted?
B
4
S
2
G
6
Posts: 50
Reputation: 1,690

Post » Tue Jul 15, 2008 8:53 am

i found that most texture errors were fixable with restarting the app or just trying again. Would be nice if he could fix it though..
B
6
S
1
G
4
Posts: 66
Reputation: 1,532


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 5 guests