Example: Load data from Json to array and populate game card

4

Attached Files

The following files have been attached to this tutorial:

.capx

load-data-from-json-into-array.capx

Download now 677.27 KB
.JPG
.zip

Stats

11,468 visits, 17,297 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 22 Apr, 2014. Last updated 19 Feb, 2019

This was written as an example for a fellow member in the forums to show how to populate a playing card with data.

I have attached an example .Capx.

<== It can found on the left hand side of this tutorial:

What does it use?

project files Array Spritefont System Expressions Instance Variables

Instructions for usage is simple

Click the button on left to randomly draw a card.

Special Cosmetics.

Shows current card and total card

Shows card image using current card instance variable

The first card is a placeholder an is not included in shuffle (random(1,numbercards)

Numbercards is the array.width

Remember array counts 0 as 1 so you will notice for displaying total cards as a number I array.width - 1

Also I am using 2 dimensional array as I wanted to group card data together. Open json to get a better idea.

I also used instance variables, this is not needed, it was more to show a point of view of the data being retrieved.

NOTE:

This is filed under Capx Examples and the attached capx is the tutorial itself. It is merely as an example, and not a finished product. It is merely for demonstration purposes.

.CAPX

load-data-from-json-into-array.capx

Download now 677.27 KB
.JPG

randomcard.jpg

Download now 41.03 KB
.ZIP
  • 1 Comments

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