Instance Variable

2

Attached Files

The following files have been attached to this tutorial:

.capx

instance-variable.capx

Download now 266.66 KB

Stats

2,845 visits, 4,383 views

Tools

Translations

This tutorial hasn't been translated.

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.

Published on 13 Jan, 2014. Last updated 19 Feb, 2019

Instance Variable

With Instance Variable you could do amazing things. Your imagination is the limit. Here is demo to start you off.

Create new project and call whatever you like. I am making my project Instance Variable.

Set Layout to 640 x 480

Margin to 640, 480

Window size to 640, 480

Call this layer BG

Create another Layer and name it Player

Create another Layer and name it HUD, do not forget to set PARALLAX to 0, 0

Create player and name it whatever you like I am calling mine HERO

Give hero behaviour 8 direction and flash

Create Wall and behaviour solids

Wall should be on BG

Create another layer and call it Objects. On this layer we can add our other stuff like pickups, door, and switches and so on

First object let’s say Pickup like fruit in this case BANANA, STRAWBERRY and so on

Just name it Fruits

Give INSTANCE VARIABLE NAME say Fruited and NUMBER 1

Now open your animation of first Fruit and set frame rate to 0

Now add frame and import another object in and set that anim to frame on and so on

Now Give second frame INSTANCE VARIABLE NUMBER 2 and so on

Create about 4 pickups

Create TEXT and name it Score

Create another TEXT name it FruitID

Add code BELOW

Let’s create enemies

Same as above about INSTANCE VARIABLE and create about 4 enemies

Each having Bullet behaviour and set angle NO

Bullet speed = 200

Angle set NO

Create TEXT and name it EnemiesID

Create another TEXT and name it Enemydestroyed

Add code BELOW

Let’s create door & Switch

Same as above about INSTANCE VARIABLE and create about 4 doors and name it DoorID and create 4 Switch same or see DEMO

Add code BELOW

your main screen looks something like this

and your code

Happy learning

.CAPX

instance-variable.capx

Download now 266.66 KB
  • 0 Comments

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