FPS throw towards screen

Get help using Construct 2

Post » Sun Nov 17, 2013 9:43 pm

Hi I am trying to have a sprite thrown from the bottom of the screen (via an animated hand sprite). I want it to look like it is shrinking into the screen simulating it being thrown and moving toward the enemy.

So it should look like a little hand throws a ninja star. The star shrinks as it moves toward the mouse position that was clicked.

I can't for the life of me figure this out.

Any help or guidance is appreciated.

Thanks
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Sun Nov 17, 2013 9:57 pm

In this case I FPS I meant First Person Shooter not Frames Per Second
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Sun Nov 17, 2013 10:58 pm

Here is what I have so far:
https://www.dropbox.com/s/z4pb226wxdjz8bg/ninjastar.capx
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Sun Nov 17, 2013 11:42 pm

Have a look at this tutorial. Its talks about seudo 3D which is really what you are trying to do.

Its a bit heavy on the math side if you are not in to that, but its a great tutorial.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Nov 18, 2013 12:05 am

Thanks, that's way over my head at the moment. I'm just getting into CS2. I simply need to scale a sprite down as it moves to the mouse pointer position.
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Mon Nov 18, 2013 7:58 am

You could do something like this.

.capx

If you are new to lerp() then look in the FAQ section, there are some great explanations there about it.

What you can change in this example to make it fit your needs is the "speed" of the lerp, which is the 5 in 5*dt

You can also play around with maybe making the end size of the sprite vary depending on the click position. Thats the Sprite.originalHeight/2 you can change (and width to).

Hope it helps.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Nov 18, 2013 4:54 pm

@cvp Perfect thanks so much.
Here's what I did with that so far:
https://www.dropbox.com/s/z4pb226wxdjz8bg/ninjastar.capx

One thing though how do I keep objects within a set boundry on the screen? I don't want the enemies to appear near the score. I have them bound to the layout but they get behind the score and it gets wonky. Is there a way to box them in below the score?

Thanks again. You really helped.
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Mon Nov 18, 2013 5:44 pm

So I need to do two things to make this perfect for what I need:
1-How do I keep objects within a set boundary on the screen? I don't want the enemies to appear near the score. I have them bound to the layout but they get behind the score and it gets wonky. Is there a way to box them in below the score?

2-For some reason the enemies are doing something strange. I have it set up where a puff of smoke appears then spawns a ninja which after a 3 second pause spawns a cut sprite of the same ninja and a screen flash causing damage to the player.

If the player hits before this then the ninja is destroyed and added to the score.

Everything works fine as long as you don't kill a ninja as soon as you do every time a new one is generate the screen flashes before they actually cut you. Which is not what I want. I want the pause, to give the player a chance then the cut.

Can anyone see what I'm doing wrong?

Here is the latest:
https://www.dropbox.com/s/q9xbjqqyse3qiv7/ninjastar1.1.capx
B
10
S
3
Posts: 113
Reputation: 1,191

Post » Mon Nov 18, 2013 9:57 pm

I dont have the plugins installed that you are using, and currently I am not adding any as I am afraid of my Tizen projects

But.. I can offer a comment or two.

1: When you spawn our enemy you just have to exclude the areas you dont want. e.g. if your screensize is 100x100 and you dont want to use the first 10 pixels your random call (if that is what you are using should be: 10+random(80)

2: It sounds like there is a variable you forget to reset when the enemy is killed. Try running it in debug mode and follow the variable that makes your screen flash.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Tue Nov 19, 2013 3:00 am

Thanks, I'm still going crazy trying to figure out why the enemy is getting an extra hit it.

Arggghh....
B
10
S
3
Posts: 113
Reputation: 1,191

Next

Return to How do I....?

Who is online

Users browsing this forum: beohs, boybacteria and 30 guests