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.

Dark GDK / inventory help...

Author
Message
Brum_
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 29th Apr 2009 18:56
hi guys,

i'm new to this forum and i need some help plz
i have to make a application game for my study but i can't figure out the error...
i want to try to make an inventory, which will open when you press "b"-key and it closes again when u press it again...

this is what i have:


backpack is the variable i picked to use, and 26 is the sprite ofcourse.

Hopefully is there someone who can help me
thanx a lot in advance!!!

Bram
jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 29th Apr 2009 20:55
WHat exactly is the problem?
Its a very small sample. THis jsut might help, switching these two lines round:

dbSprite(26, 10, 10, 26);
dbShowSprite(26);
Brum_
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 29th Apr 2009 21:13
the problem is the fact that

OR

it doesn't show and it moves my character to the left (which isn't initiated in the code anyway..)

OR

i have to press the "n" key to show the inv..
and can just press "b" to hide the inv...
anyway i'll try this, lets see what will happen
Brum_
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 29th Apr 2009 21:17
hmm because i'm a new member not my replies aren't visible at the same moment..

anyway a short edit:

if i have the code like showed above.. it does nothing,
i guess because the loop continues sees that the backpack var is 1 and hides the sprite again...

if i make the code like this:



i have to press the "n" key to show inv. and "b" key to hide inv.

hopefully someone can help
ABXG
15
Years of Service
User Offline
Joined: 1st Apr 2009
Location: Canada
Posted: 29th Apr 2009 21:46 Edited at: 29th Apr 2009 21:49
I had a problem with my menu screen that sounds similar to the problem you are having now. The problem was that the menu was opening and closing very fast and as a result was not being displayed. The solution I came up with was to create three global variables and use them like this:






Essentially what my code does is makes sure that at least 250ms have passed from the time the menu was last opened or closed before it can once again be opened or closed.

------------------------------------
Currently 1300+ lines of code into an "over-the-shoulder" action RPG with combat based on rag-doll physics.
Brum_
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 29th Apr 2009 21:49
thanx man!! that looks very promising i'll try it right away
ur my savior i guess
heyufool1
15
Years of Service
User Offline
Joined: 14th Feb 2009
Location: My quiet place
Posted: 29th Apr 2009 22:32 Edited at: 29th Apr 2009 22:34
The problem is that as soon as you press the key once the next if statement is executed and because that code is really in a loop then as long as you have the key pressed it will keep executing that code over and over. So try this:


Brum_
15
Years of Service
User Offline
Joined: 29th Apr 2009
Location:
Posted: 29th Apr 2009 23:13
@ heyufool1: ur tha man! xD it was the first code i completely understood, and which was in my mental capabilities to change so that it completely worked

for the guys who might want to know how i finally did it:


thanx all for your cooperation
and quick replies !!!

Login to post a reply

Server time is: 2024-09-30 23:26:56
Your offset time is: 2024-09-30 23:26:56