Fruits
Add a new Sprite to the Layout
Add a new Sprite to the Layout
Call it Fruit
Call it Fruit
In the Sprite Editor
In the Sprite Editor
Choose Load Animations
Choose Load Animations
Select the Fruits zip file you downloaded earlier
Select the Fruits zip file you downloaded earlier
Delete the default Animation 1
Delete the default Animation 1
Create a new Family called FruitFamily
Create a new Family called FruitFamily
Add all the fruits to the family
Add all the fruits to the family
Rename Layout 1 to Game
Rename Layout 1 to Game
Add a New Layout ONLY
Add a New Layout ONLY
Call the New Layout Temp
Call the New Layout Temp
A Family is a group
A Family is a group
All the Fruit in the Family (group)
All the Fruit in the Family (group)
Can inherit (have) the same properties!
Can inherit (have) the same properties!
Click on the FruitFamily name.
Click on the FruitFamily name.
Add three instance variables to the Family
Add three instance variables to the Family
Add 3 Behaviours to the Family
Add 3 Behaviours to the Family
Add an effect to the Family
Add an effect to the Family
To set all the individual scores to the different fruits we will add them all to the TEMP layout.
To set all the individual scores to the different fruits we will add them all to the TEMP layout.
Drag the Fruit from the Fruit Family into the Temp Layout
Drag the Fruit from the Fruit Family into the Temp Layout
Change the Initial Animation so that you have one of each fruit.
Change the Initial Animation so that you have one of each fruit.
Click on each individual fruit in the layout and change the fruitScore.
Click on each individual fruit in the layout and change the fruitScore.
Cherry: 50, lemon: 200, Orange: 1000, Tomato: 5000, Melon: 20 000,
Cherry: 50, lemon: 200, Orange: 1000, Tomato: 5000, Melon: 20 000,
Coconut: 100 000, Pumpkin: 500 000, Watermelon: 2 000 000!
Coconut: 100 000, Pumpkin: 500 000, Watermelon: 2 000 000!
To simplify working with instances (duplicates) we will be using Templates
To simplify working with instances (duplicates) we will be using Templates
Templates help managing instances in larger projects.
Templates facilitate conveniently updating properties for multiple instances across the project in the editor.
We don't have control of where and when an instance will be created
We don't have control of where and when an instance will be created
Since the fruits are physics objects they will move around and might
Since the fruits are physics objects they will move around and might
merge with a match and trigger the creation of a new fruit.
merge with a match and trigger the creation of a new fruit.
Templates are the key to solving this problem.
Templates are the key to solving this problem.
Starting from the first fruit to the last make each a Template and number them from 0 to 7
Starting from the first fruit to the last make each a Template and number them from 0 to 7
Add code to spawn and drop fruit
Add code to spawn and drop fruit