Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Could use a little help

Author
Message
Trisect Development
21
Years of Service
User Offline
Joined: 8th Sep 2002
Location: Denmark
Posted: 10th Sep 2011 18:36
I need to draw a playfield 4x4 with sprites.

I have images called back.png, blank.png, brick1.png, brick2.png, brick3.png and brick4.png

back.png is number 0, blank.png is number 1, bricks1.png is number 2 a.s.o.

Now I want to display 4x4 sprites i a grid from numbers from an array.

The array could be some thing like

1223
3413
3214
4321

How do I set this up?
I have tried different things but I always get to many sprites. I cant figure out the easy way to do this.

iOS Apps from Trisect Development.
Click here.
Rich Dersheimer
AGK Developer
14
Years of Service
User Offline
Joined: 1st Jul 2009
Location: Inside the box
Posted: 10th Sep 2011 18:58
Well, for starters, I don't think you can use zero as an image number. AppGameKit reserves this for its own use.

Next, you have to make a decision on how you will store and assign the data for the image number for each sprite.

Since AppGameKit doesn't have DATA statements, there's basically two ways to do this.

1. Store the data in an external file, and read it in during runtime.

or

2. Store the data as literals in the program itself.

There's pro's and con's to either method, but you gotta decide which one before you start coding.

After that, the image numbers would likely be put in an array. A 2 dimensional array could be used to keep track of the sprite image and location at the same time. A User-Defined-Type (UDT) array could also store much more info about each brick (how many points for breaking it, is it a power up, etc.)

Let me know if this helps, and I'd be glad to give you some input... I'm making a break-out game of my own, you see, so I've been thinking about these issues as well.

Login to post a reply

Server time is: 2024-04-20 01:13:53
Your offset time is: 2024-04-20 01:13:53