Physic Objects + Drag&Drop control

For questions about using Classic.

Post » Sat Dec 12, 2009 3:27 pm

Hi,

Right now I am working on a simple game with physic objects. It's goal is to destroy a building with some kind of projectile (e.g. cannonball + catapult). Here is a first screenshot to visualize my ideas...

[url:nbxje8pe]http://www.oinobareion.at/files/game.jpg[/url:nbxje8pe]

The building on the right side, as well as the cannonball on the left are made up of objects with physical behavior. So far so good. Now my problem: I want to integrate a Drag&Drop control for the catapult. The player should have the possibility to drag the left part of the catapult down and then let go in the right moment. The further he drags it down, the more impulse is given to the cannonball. Is this kind of control possible in Construct? And how?
B
2
G
3
Posts: 14
Reputation: 878

Post » Sat Dec 12, 2009 5:52 pm

http://dl.dropbox.com/u/2670855/catapult00.cap

It's just 3-minutes-sketch
:) I hope it will help you to start :) 1 action actually. And it's just one way to do it..
Sorry for incompleteness.

P.S. Also I didn't use TimeDelta, but it's very usefull to do it.
P.P.S. The main task for you is to set up physics parameters of all objects.
B
3
G
3
Posts: 29
Reputation: 933

Post » Sat Dec 12, 2009 6:18 pm

Well, here's my quick example. I guess Russ was quicker :P

http://www.box.net/shared/0aojoc43i3

Edit:
Uh... mine uses physics in the manner you described, though :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sat Dec 12, 2009 6:57 pm

deadeye
oh man, you are a pro! :D :oops:
You almost did all the job :)
NICE.
B
3
G
3
Posts: 29
Reputation: 933

Post » Sun Dec 13, 2009 1:19 pm

wow! thank you very very much. it's so simple and already fun to play with :P

the next thing i will try to implement is some kind of imaginary line that crosses the screen. only when all polygons of the castle lie below this line, the castle can be considered as "destroyed". any ideas how i can implement this?

[url:27j9oukc]http://www.oinobareion.at/files/line.jpg[/url:27j9oukc]
B
2
G
3
Posts: 14
Reputation: 878

Post » Sun Dec 13, 2009 1:30 pm

The line is simple :D : Just make it check "collision" with the castle and have a timer(timer start when no collision and goes for 1 sec or so).
I am kinda new to construct so i am not really sure if this works... :?:
B
18
S
2
G
4
Posts: 15
Reputation: 2,276

Post » Sun Dec 13, 2009 4:23 pm

[code:3iv81owa]
+ System: For each object purpleWall
+ purpleWall.Y is greater than line.Y
-> Activate "you win" scenario
[/code:3iv81owa]
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Sun Dec 13, 2009 6:31 pm

thanks again, but I'm afraid there's still a problem: because a few wall elements are already below the line right from the very start, the "you win" scenario gets activated immediately. is there a simple way around this ;) ?
B
2
G
3
Posts: 14
Reputation: 878

Post » Sun Dec 13, 2009 10:29 pm

yeah I did this once. Also you need to make sure the scene has "settled".

What I did is check collision on a "forbidden area" sprite, and if nothing had touched it for a while, go ftw.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Dec 13, 2009 11:47 pm

[quote="BarneyGumble44":spndb38e]thanks again, but I'm afraid there's still a problem: because a few wall elements are already below the line right from the very start, the "you win" scenario gets activated immediately. is there a simple way around this ;) ?[/quote:spndb38e]

Oh yeah, duh :P. Well, I'm stupid.

Well, you could have a "Win" variable, and do something like this:

[code:spndb38e]
+ Always
-> Set "Win" variable to 0

+ For each object purpleWall
+ purpleWall.Y < line.Y
-> Add 1 to "Win" variable

+ "Win" variable = 0
-> You win
[/code:spndb38e]

Or do it Madster's way.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests