How do I make a game where you have to throw a ball

Get help using Construct 2

Post » Fri Aug 11, 2017 1:33 am

Hey all. How would I go about making a game where there are stacks sprites/cups stacked on top of each other and then a player has to throw something like ball/sprite at the cups in order to knock all the cups down within a certain amount of time. How would I go about making this be realistic and could someone provide a capx example illustrating this?
B
12
S
3
G
3
Posts: 36
Reputation: 2,274

Post » Fri Aug 11, 2017 2:42 am

Use catapult / physics example that comes with Construct 2 ( File, new project then open that instead of a blank project )
B
24
S
11
G
2
Posts: 64
Reputation: 2,978

Post » Fri Aug 11, 2017 5:32 pm

How would I incorporate the swiping up effect tho for if I wanted the player to have to swipe up with their finger on the object/sprite in order to shoot him upwards? And how could I make it look like the cups are behind the player sprite but also further in the distance compared to the player sprite? I am trying to achieve the paper toss boss ios game effect to make it like that game.
B
12
S
3
G
3
Posts: 36
Reputation: 2,274

Post » Sat Aug 12, 2017 8:36 am

apalm1341 wrote:How would I incorporate the swiping up effect tho for if I wanted the player to have to swipe up with their finger on the object/sprite in order to shoot him upwards? And how could I make it look like the cups are behind the player sprite but also further in the distance compared to the player sprite? I am trying to achieve the paper toss boss ios game effect to make it like that game.

Detect the touch of the player... for the swipe
1-create 4 variables on the player a,b,c,d
2-on start of touch set 2 of the variables (a, b) to the x and y of the touch
3-on end of the touch set the 2 other variables (c, d) to the x and y of the touch
4-use these 4 coordinates to create a force vector and 4.1-apply the length of your vector as impulse force to the ball , 4.2 apply the angle of your vector to the angle of your impuls
Steps 2 to 4 should happen in a single tick/event
... about making the cups look like they are in the distance, im not really clear about that ( maybe you need to use parallax or something else), not sure though
'Image'Image'Image
B
23
S
8
G
2
Posts: 101
Reputation: 2,932

Post » Sun Aug 13, 2017 3:53 am

Sounds like you are talking about fake 3D ( throwing into the screen as opposed to left right ). In that case physics probably won't work. I tried and decided it was easier to code my own simplified physics. Once you start scaling Physics objects their behavior becomes too unpredictable, and you need scaling ( z axis ). So either code your own physics or figure out a way to compensate for scaling issues ( if possible at all ).

As for swiping you have the answer above.
B
24
S
11
G
2
Posts: 64
Reputation: 2,978

Post » Sun Aug 13, 2017 11:19 am

@Donald Cela

I'm also trying to make something similar. I originally used the code from the piggy shoot template, but wanted a swipe up instead.

But I'm stuck at step 4 of your explanation. What do you mean y force vector? Perhaps you could enlighten us with a more code-shown explanation? :)

Thanks!
B
13
S
7
G
4
Posts: 143
Reputation: 3,581

Post » Sun Aug 13, 2017 12:00 pm

Basically he's trying to say use distance ( length of swipe ) from point where you started to swipe to the end point of your swipe. Longer the distance, apply more force, more up movement ( start.Y to end swipe.Y can be used to apply force upwards
B
24
S
11
G
2
Posts: 64
Reputation: 2,978

Post » Sun Aug 13, 2017 2:45 pm

Would someone mind posting a capx file with an example illustrating the effect I want to achieve?
B
12
S
3
G
3
Posts: 36
Reputation: 2,274


Return to How do I....?

Who is online

Users browsing this forum: work3 and 11 guests