AI (Artificial Intelligence) in Construct 2

3

Index

Attached Files

The following files have been attached to this tutorial:

.capx

artificial-intelligence.capx

Download now 569.65 KB

Contributors

Stats

13,128 visits, 33,847 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Ok now if we add more layers then people who has free version of Construct 2 will not be able to anything and people who are beginners will not understand. Therefore I am only going to use 4 layers.

What we need now is some other sprites like wall, enemy collision for AI, also for player too.

Insert sprite and name it Solid_Wall. Behaviour to solid

Insert sprite name it Enemy_Collision. Behaviour to solid

Enemy_Collision

For this object add Instance Variable name it Enemy_Action set to Text “JUMP”

Before you open Event Editor add 2 more Event Sheets so you will 3 events sheets. Name it as:

1. Game_Event

2. Enemy_Event

3. Player_Event

At this stage you must place your Solid_Wall, and Enemy_Collision like below or running your project player and enemy will fall down:

Solid_Wall:

Enemy_Collision:

You can place this sprite on Walking Path. Now we finish adding all sprites. Time to stat code but before we do that name your first layout Game_Layout and also name event sheet 1 to Game_Event. Open your event editor and let’s add some code. Your event below:

Now go on to Main event and right click, from here click on Include Event Sheet. Add all here also add Global variables too

1. player_isAlive = 1

2. animation_Speed =8

Now open Player_Event and enter this:

Here is complete code for player:

What you see here is it’s in group

  • 0 Comments

  • Order by
Want to leave a comment? Login or Register an account!