Four problems!

Get help using Construct 2

Post » Sat Apr 23, 2016 12:55 pm

How can I add health and if you touched a solid enemy, you lost your health. And also, how to add collectable coins and add it to the score tab. AND (Final and) how to make if you fell down you go back to the main menu layout. PLEASE HELP!
B
5
Posts: 15
Reputation: 255

Post » Sat Apr 23, 2016 2:02 pm

Hi, welcome to Construct 2! These are all easy things you can learn by reading the manual and the tutorials on this site, particularly about global variables! Here is a good beginners guide: https://www.scirra.com/tutorials/37/beg ... t-2/page-1 In particular the section called "Keeping score" will help you!

Good luck!
Image



Coming soon on Steam!
B
16
S
9
G
3
Posts: 204
Reputation: 3,466

Post » Sat Apr 23, 2016 6:45 pm

How do you want to do the health ? sprite or variable text.

If you are doing Sprite based for health then just make animation of 5 frame of what ever image you want to use but maker sure its like this for frame 5 ++++ like as in four of the same thing and on frame 4 +++ make three of the same thing and again for 3 and 2 but leave the last one blank all frame must have the same size frame. and have it start on the sprite's property on frame 5. And your code will be something like this Player collide with enemy -> on health animation set frame number to Self.current frame-1. (what this does is that when you hit your enemy then your health animation since it is set on 5 it will be at 4 because Current frame is at 5 and we added in to subtract 1 which is 4.

If you are doing variable based then on player sprite add in a variable to the player and name it health and set it to 100 this is going to be your max health point. Next you want to code in the player collide with enemy and then subtract from player variable health by 10. And this will give you a health of 90 after first and then again at 80 and so on.

Now for the collection of coins you will want to make a global variable and call it coin and make sure that it is number and it's number is at 0, and not on text variant. next you want to do player collide on coin to system add to global variable coin + 1

If you wish to view the coin or as a score then its just a matter of adding in a textbox object and coding in this Every tick-> textbox object , set text to the global variable name Coins. no " " do not use that.

and if falling down then you want to add in a sprite and lets call it falling check. and do this code if player overlap the sprite " fallingcheck" then system go to layout "main menu"

This is just one easy example now everyone has their own takes of how they want their game to function and take in to account that not every game uses the same thing. The best way to know what you want is to play other game and figure out how they did it and read up tutorials section for more.

Oh and learn to make mistakes because if you dont you will not figure out how to solve debug issue.

If you have any more question feel free to message me, I'll try to help as much as I can.
B
52
S
24
G
6
Posts: 391
Reputation: 7,845


Return to How do I....?

Who is online

Users browsing this forum: mihirolover, Prominent, tarek2 and 12 guests