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.

DarkBASIC Professional Discussion / Scrollable inventory

Author
Message
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 24th Mar 2013 19:10
Hello everyone,
what i try to accomplish is scrollable inventory, i attach my projects here.The problem is that in my "memblocks.dbpro" project everything works fine in the other project i can't understand why drawing function do not work properly, it only does half the job.I commented "interfaceinvmem.dbpro" project where memblock's code is used with "MEMBLOCKS"

If you run "interfaceinvmem.dbpro" with "space" you make new item in inventory if you scrolldown it moves away as it should.That's if it's at first row.If you place it at 4th row and scroll it goes down and don't hide.

I'm lost on this...

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
Phaelax
DBPro Master
23
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 25th Mar 2013 04:58 Edited at: 25th Mar 2013 04:59
I tried to run the program and it did the first time (after I removed the smoke sprite since you forgot the image) and saw what you were referring to. But after that, the program would just crash when I tried to compile.


I wrote a new demo, using the images from your example. For it to work, you'll need the Matrix1Utils plugin and Advanced 2D plugin.


It's a quick demo, so no scrollbar. Use your mouse wheel to scroll instead.

Basically what this does is draws your inventory items onto a separate image then pastes that image on top of the inventory image. Using Advanced 2D we can set the clipping area to match the size and location of the inventory.




"You're all wrong. You're all idiots." ~Fluffy Rabbit
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th Mar 2013 14:09
I'm aware of crashes, not sure why it did that when you change something sometimes works fine sometimes crashes.You need to delete "inventory" file and recompile for this to work.All this started with memblock code.I find cliping is way better than memblocks it's just smoother, problem is that i didn't know about this method.Few lines of code with right plugins make wonders, no complicated calculations and stuff like that.I see there is still much to learn.I'm glad there are people like you roaming the forums.I admire you and thank you, you are good teacher.I'll examine your demo and it should be a breeze to make it right.

Coding is My Kung Fu!
And My Kung Fu is better than Yours!
luskos
19
Years of Service
User Offline
Joined: 28th Jun 2007
Location:
Posted: 25th Mar 2013 14:49 Edited at: 25th Mar 2013 14:51
I'm done.I have one last issue.When i create few items and start moving one of them others loose depth near transparent parts of the image.

Here is my solution for when you move item in inventory:


Here is the part that draws items in inventory:


Here is the whole thing:


Coding is My Kung Fu!
And My Kung Fu is better than Yours!

Login to post a reply

Server time is: 2026-07-08 03:49:36
Your offset time is: 2026-07-08 03:49:36