0 Favourites

Help with zombie type game.

  • Hi guys! So, I'm kinda new here, and I have some questions that I couldn't find in the forum, so here you go:

    1-How can I make the guy to shoot only one bullet per second? With me, he shoots like 132148090 bullets.

    2-How can I "make" health to the character and the zombie and how can I make the zombie attack me when he gets close?

    3-How can I make the zombie to respawn after I kill the other? Like, I kill one and the another shows up, or another 10, xD.

    Last (I guess, xD): How can I make a scorebar and add points to every zombie I kill?

    Thank you very much and sorry my bad english! ;)

  • This variables ar needed:

    firing delay:12

    firing state:0

    on mosue button down

    if firing state <= 0

    :

    set firing state to firing delay

    And fire bullet

    --

    Also:

    always:

    firing state = firingstate-1

    Or reverse, buit this solution is better.

    It provides direct firing when having long firing delay and just tapping the mouse,

  • Cookies1304: You should also follow the Beginner's guide to Construct 2 that covers most of your questions and then take a look at the how do I FAQ which also contains quite a few articles concerning your very same questions.

    If you're still stuck, don't hesitate to post.

  • Thanks guys! You helped a lot! :D

  • This variables ar needed:

    firing delay:12

    firing state:0

    on mosue button down

    if firing state <= 0

    :

    set firing state to firing delay

    And fire bullet

    --

    Also:

    always:

    firing state = firingstate-1

    Or reverse, buit this solution is better.

    It provides direct firing when having long firing delay and just tapping the mouse,

    Thanks but, where can I do that? Where in the event sheet? :)

  • Just do

    Keyboard: Space is down
    System: Every 1.0 seconds
      -> TheGuy: spawn bullet

    Or with Mouse: Left button is down

    Same idea

  • The FAQ covers all of your questions.

  • Just do

    Keyboard: Space is down
    System: Every 1.0 seconds
      -> TheGuy: spawn bullet

    Or with Mouse: Left button is down

    Same ideaNo, it's not.

    That solution is not an acceptable solution,.

  • Just do

    Keyboard: Space is down
    System: Every 1.0 seconds
      -> TheGuy: spawn bullet

    Or with Mouse: Left button is down

    Same idea

    Thx! It worked.

    Now, last question: How can I make the zombie when CLOSE (Colliding) subtract ONLY 10 of my health and ONLY one in one second, cuz in the Ghost Shooter it just teaches how to make the player get destroyed. Thxxx!

  • That solution is not an acceptable solution,.

    @Urled: how so ?

    Please explain yourself.

    As far as I'm aware, this is a perfectly well-fit solution to use in C2.

    Edit: and for Cookies1304: the beginner's guide also teach how to remove health from the monsters. Simply apply the same process to your player, and time it like Yann showed you.

  • I'm trying, I put like this:

    Sprite4 (Zombie) On collision with Sprite2 (Player)

        (Sub Event)-----Every 1.0 seconds: Sprite2 Subtract 10 from HealthPLayer

  • This would never work

    A collision check is a kind of condition called trigger.

    Triggers are instantaneous conditions, they are true "at the moment" if sprite4 collides, it's true and then false even if sprite4 still overlaps sprite 2

    Maybe you'll notice you have an "is overlapping condition?" :D

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Cookies1304

    If your zombie have an attack animation, this method is better:

    1. Condition:

    -Zombie Is overlapping Player

    Action:

    ->Set Zombie animation to "attack animation"

    2. Condition:

    -Zombie On animation "attack animation" finished

    -Zombie Is overlapping Player

    Action:

    ->Subtract 10 from HealthPlayer

    ->Set Zombie animation to "default animation"

  • Well guys, I tried the overlapping, but I'm not using any animations, but it's still the same, he just takes 10hpp when he get close, and only takes another 10 if I back off and he gets closer... :(

  • > That solution is not an acceptable solution,.

    Urled: how so ?

    Please explain yourself.

    As far as I'm aware, this is a perfectly well-fit solution to use in C2.

    it's cause every second works with the system timer, so really, this is going to look kind of stupid and cheap if you shoot, because sometimes itll take one second to fire a first shot, or some times itll take an instant.

    what needs to be done is

    Always:

    subtract from gun('timer') : TimeDelta

    On Space pressed:

    & gun variable 'timer' less or equal 0

    spawn object bullet.

    set gun('timer') to 1

    this will make it so your gun can only shoot every second, but it will also make it so that if a second has passed since your last shot, the first shot will come out instantly as expected

    something like this is usually ideal for a On hit Reloading type timer

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread sticky
763 305,734
asikanddestroy's avatar
asikanddestroy
Unread hot topic
232 177,700
Tetriser's avatar
Tetriser
Unread hot topic
135 14,304
melaniko's avatar
melaniko