Need help with a game

so far I’m trying to add a score, so amount of coins collected, and player take damage from the flying pigs.
then also health regeneration from jerry cans.

but I’m not sure what to do.

Picture of the game

Can you share the wick file?

Yeah, I will share it

edit: I cant share it, since I am new I cant upload attachments

1 Like

Then can you post the code?

Whats a code?

Oh to make those features you need to script them in javascript

ohh right, can I send you the file over email? or gmail?

Yeah. You can find my email on my website: https://nuggetofwisdom.github.io/

alright i sent you an email

1 Like

I didn’t get anything

thats weird, ill send it again

1 Like

Ok I sent it again

Part C3-17-2021_14-39-43.wick (79.9 KB)
Unfortunately I’m not the best at coding so maybe @pumpkinhead @awc95014 or @Jovanny could help?

Okay thank you

Well i can break this down into 2 steps for you if you want to do this in the future.

A way to detect when a coin is hit is to use hit triggers. Here are some steps to use them.

  1. Make Your objects clips and name them for example a coin could be named “coin” and a plane could be “player”
  2. Add code to your plane object in an Update Script, you can add one by clicking “add script” and going under timeline, then add the following code

if (this.hits(coin)) {
project.score += 1;
};

  1. Create a text box, put in some placeholder text, and name it scoreCount. This hooks it up to the code below.
  2. Next, in the code for the frame (Box with all the content at the bottom, make another update script with this code.

scoreCount.setText("Score: " + project.score)

This sets the counter to our score value whenever it goes up.
And theoretically you should be done.

If this doesn’t work for you, I got most of this from Luca’s tutorial. Watch it here!

Hi @evilmeap12, welcome to our forums:

Here is a tutorial for collectibles, you could do a similar thing:

Collectibles Tutorial

https://www.youtube.com/watch?v=6VnJptZIo8A&t=1s

For the health bar, you could also do something similar to this, but instead of hitting the button, you will apply the logic when you collide with the jerry cans.

Health Bar Tutorial

https://www.youtube.com/watch?v=EDAfQRHKxXU

Hope this helps.

thank you I will try it when I get home

Thank you, I got the score working now :D

I do like the Bar but im having a hard time because of collision. When the pig hits the plane I want to plane to lose health. the collision is what is hard for me, im not sure what to do.

under plane update script tab write the following:

if(this.hits(pig)) {
// lose health
}

Replace the comment by the logic for losing health.