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 / CopyImage and blank sprite

Author
Message
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 14:47
In order to realise an horizontal scrolling, I try to copy a part of an image loaded from file to a new image.
Then I affect this new image to a sprite.
The result is a blank sprite and I do not unterstand why...



Maybe someone see the mistake or knows more about copying images?
Thanks

Cry "Havoc!" and let slip the dogs of war
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 16:01
How often are you doing this code?

I have to assume that the code listed not actually done in the same place. It doesn't make sense otherwise.

Part of the description for the CopyImage command says:
Quote: "This is a slow command and should not be called every frame."


Are you sure that the variable xBuffer is always set so that you have 480 pixels available from that point to the right edge of the image?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 17:46
This code is done when I scroll the background.
That means when the main character reach an extremity of the screen.
It's executed once.

But the background image sceneT01.png is 2560 x 300 pixel.
Maybe too much for AGK.
xBuffer =0 at the begining of the game.

Cry "Havoc!" and let slip the dogs of war
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 20th Dec 2012 18:17
There may be a 1024x768 restriction on images. It might be better to weld two together.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 19:09
Quote: "But the background image sceneT01.png is 2560 x 300 pixel."

Yup, that is too big for AppGameKit for now.

And I hope that you are only doing 'imgBackdrop =LoadImage ("sceneT01.png" )' at the start of the app. It only needs loading once.

You would probably be better off shifting the actual background image instead of copying a part and displaying that.

You can position sprites with negative values so that they are off to the top or left. It is easier and faster and less memory intensive to shift a sprite than to make a copy a piece of an image and create new sprite.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 20th Dec 2012 22:08
Yes, I load the image once, in the initialisation section of the game.

I began to make my scrolling using negative values.
It works perfectly except with the awful blur of the background.

So I'm looking for another way: loading the whole background in memory and displaying only a section, sized like the screen. So I hope the render will be clear without blur.

Cry "Havoc!" and let slip the dogs of war
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 20th Dec 2012 22:32
Is it blurring when you move it? Or is it blurred to begin with?

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 10:59
After realising that only a max 1024 pixels sprites could be handled by AppGameKit, I try to create a backdrop image from "strips" that are 1024 pix width sections of my background.

I create a background image from a section from the screen

The final background is still blank...

Whats wrong with this code?




Cry "Havoc!" and let slip the dogs of war
LeGugusse
17
Years of Service
User Offline
Joined: 15th Feb 2007
Location: Paris - France
Posted: 21st Dec 2012 11:16
I tried some very simple application of copyImage()and my conclusion is it doesn't work on my Galaxy Note...

It works well on Windows but not on Android 4 device...

Cry "Havoc!" and let slip the dogs of war
Ancient Lady
Valued Member
20
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 21st Dec 2012 15:56
As I asked in your post in the Android forum subset, what version of AppGameKit are you using in Windows (v1076 or v1085)?

Are you using a Player and, if so, what version is it and where did you get it?

These are all pieces of information needed to help figure out what the issue might be.

Player incompatibility can be blamed for a lot of apparent failures.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master

Login to post a reply

Server time is: 2024-11-24 03:47:57
Your offset time is: 2024-11-24 03:47:57