FPS throw towards screen

0 favourites
From the Asset Store
Throw daggers and hit the most fruit! Watch out for the wind, if you run out of daggers you'll lose the game!
  • 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

  • In this case I FPS I meant First Person Shooter not Frames Per Second

  • Here is what I have so far:

    dropbox.com/s/z4pb226wxdjz8bg/ninjastar.capx

  • 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.

  • 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.

  • 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.

  • cvp Perfect thanks so much.

    Here's what I did with that so far:

    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.

  • 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:

    dropbox.com/s/q9xbjqqyse3qiv7/ninjastar1.1.capx

  • 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 <img src="smileys/smiley1.gif" border="0" align="middle" />

    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.

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

    Arggghh....

  • I'd like to help but I'm not able to open your capx for it has third party plug-ins I don't use.

  • I installed a clean version with no plug ins and rewrote the entire level.

    dropbox.com/s/pxcy41wgmh9fhf7/ninja%20star%20no%20plu%20ins.capx

    The problems I am having:

    1- The enemy is getting in a free hit after you kill one of them. Every time the appear the screen flashes and they get a free hit. It should be they appear, after 4 seconds they cut you and the screen flashes giving you time to kill them.

    2- They appear near the text. I'd like to keep them below the text

    3- The font's are installed (bangers) but not being used. I followed the tutorial but it's still not working.

    Thanks

  • Your every 4 seconds event is where the problem lies.

    It would probaly be much easier to use animations for your ninja instead of spawning new objects every time.

    Also you should add conditions so when the ninja is destroyed the other events, like the flash and stuff aren't executed.

  • I tried that but syncing the flash and the cut animation was dicey for me.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm new to this so I'm not sure what you mean by setting up a condition. I see that I can set up a sub event, the conditions available don't have a destroyed option that i can see.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)