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.

Newcomers DBPro Corner / Working with arrays

Author
Message
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 10th Aug 2010 20:12 Edited at: 10th Aug 2010 20:15
Trying to learn getting info into and out of arrays.
Please look over my code , is that a good way to do it?



For the second part of my question; How do I get that info out of it?
I tried this;




Thanks for any comments.

Mike

some cool stuff someone else said here
DVader
20
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 10th Aug 2010 21:10 Edited at: 10th Aug 2010 21:23
Here you go. Just wrote something myself rather than change yours

That grabs the image saves it into an array. Then rebuilds it out of the array afterwards. It is based on a 32 x 32 sprite but you can up those values as you wish. You could even use image width() etc to do it automatically I'll leave that for you to add.
I don't actually reload the array in this demo as it isn't needed. But once you have made and saved the array, you can just load it in and use the bottom bit of code to remake the graphic.

http://s6.bitefight.org/c.php?uid=103081
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 10th Aug 2010 21:55 Edited at: 10th Aug 2010 22:10
I see how your doing that.

How would I get it to print a Data csv Of the RGB value of a given pixel?




Something like that?

A single bitmap could hold a lot of information Just by making certain colors have different effects.
I've seen 2 map from bitmap tut's. Looks like an easy way for the user to alter the way the game plays just by switching out a bitmap.
For example; your user could swap out a Height and texture map, then place objects, trigger's, etc...just by swaping out a layout map. presto new level for your game app!

Mike

some cool stuff someone else said here
mikewhl
14
Years of Service
User Offline
Joined: 19th Jul 2010
Location: Columbus,Ohio
Posted: 11th Aug 2010 17:19
Thanks DVader, you got me pointed in the right direction.
I have learned a lot about arrays in the last couple of days!
I think I have got it to work.



This stores the value for each pixel of the bit map (0 thru 5).
Now to figure out how to use it!

Mike

some cool stuff someone else said here

Login to post a reply

Server time is: 2024-11-16 15:50:26
Your offset time is: 2024-11-16 15:50:26