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 / getchosenimage() problem

Author
Message
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 01:18
Hi,been a while since i posted problem code!

I decided to re-write the editor I was working on after losing the code, attempting to improve upon it in the process, I added a function to open add an image and put it into an array with using getchosenimage() following the tutorial for this. it stores the correct ID number in the array image_bank[] but does not seem to display the image on screen. I dont know where I am going wrong really.. any help please? here is all the code so far but I probably didn't need to paste it all
thanks for any help



Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Oct 2014 02:15
here u used imagepointer
image_bank[imagepointer] = imageID

here u choose but not show with O key
maybe because below u used imagecounter
if getrawkeypressed(KEY_O)
choose_image()
endif
if GetRawKeyPressed(KEY_Z) and imagecounter>0
dec imagecounter
setspriteimage(cursorsprite,image_bank[imagecounter])
cursorimage = image_bank[imagecounter]
endif
if GetRawKeyPressed(KEY_X) and image_bank[imagecounter]+1 <>0
inc imagecounter
setspriteimage(cursorsprite,image_bank[imagecounter])
cursorimage = image_bank[imagecounter]
endif

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 02:24
well,i use imagepointer to load in the image at an incremented part of the array, but to change the image of the cursor I use another var called imagecounter,so I still don't see the problem? I need 2 vars really,one for loading into the array at the correct position and the other to scroll through the array for changing cursors image?!

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 02:26 Edited at: 14th Oct 2014 02:34
I need 2 vars for this no? one for loading in an image into the array at the correct position, the other (imagecounter) to scroll through using z and x and change the cursors image?! In the main loop I use:
print ("Image number = "+ str (image_bank[imagecounter]))

which if I load in a chosen image,it correctly has a value of 10001

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 02:28
damn, sorry for double post, my browser seems to be acting up

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Oct 2014 02:35
where is the part to show this image/sprite u had selected with choose_image() ?
maybe a problem with sprite depth?
(i does not copied this code snipped to agk ide.)

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 02:42 Edited at: 14th Oct 2014 02:52
in the main loop
setspriteposition(cursorsprite,Mouse.x3,Mouse.y3)
the sprites image is obviously changed while I press z/x

edit *** it changes to something I see, simply a black image!

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 03:24
too tired now, I will test out a much simpler program using getchosenimage()
when I wake!

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Oct 2014 09:20 Edited at: 14th Oct 2014 09:24
yes, a pause can help much and u find a solution after sleep

u need a sub function for better debugging



AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 12:46 Edited at: 14th Oct 2014 12:48
ok,changed the code so that it needs no immediate media, you can copy/paste this code and run it, press o to open and choose an image file, also I cleared the screen to red so you see that all it creates when pressing LMB is a black square ?! So I still have no clue, even checked out the depth and isn't that. I am using the latest AppGameKit V2 . I am a bronze pledger and very proud of it

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Oct 2014 13:11
ah, u used it for stamp the selected image to screen.
the problem is your mix with 2 indexes.


AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini
shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 14th Oct 2014 13:48 Edited at: 14th Oct 2014 13:52
hah,i only had 4 hours sleep and forgot to paste the code did I? lol, anyhow I changed it to that and still just a black block to 'stamp' after (o)pening an image
here is the code this time:






Again this can simply be pasted and ran

Hail to the king, baby!
http://davidjohnwheeler.blogspot.co.uk
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 14th Oct 2014 14:10 Edited at: 14th Oct 2014 14:12
now its double
after choose_image() you set cursor image but
in choose_image() u inc imagepointer at last.

you should replace vars for indexing
cursorimageindex =cursorimageindex +1
image_bank[cursorimageindex ] = imageID

if you need pic use array[index]

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini

Login to post a reply

Server time is: 2024-04-24 23:53:59
Your offset time is: 2024-04-24 23:53:59