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 / [SOLVED] Scraggle's 9 scale slicing not working as I would expect?

Author
Message
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 7th Dec 2018 13:08
Hello

I'm trying to get the 9 scale slicing code from Scraggle to work (https://forum.thegamecreators.com/thread/218320)
So I copied the code, the myResizeImage function and the math functions.
I call the code very simply via:



But this throws a memblock error stating that the offset is bigger than the memblock size.

I attached the code + image, can somebody point me what I'm doing wrong here?

Thanks a bunch!

Attachments

Login to view attachments

The author of this post has marked a post as an answer.

Go to answer

puzzler2018
User Banned
Posted: 7th Dec 2018 20:44
I recollect something in particular with the Resize code bit and Scraggle corrected it maybe in another thread - unsure- i think only Scraggle can help here
puzzler2018
User Banned
Posted: 7th Dec 2018 20:45 Edited at: 7th Dec 2018 20:46
It was corrected a bit further down that thread

Quote: "
function myResizeImage( Image, Width, Height )
s = CreateSprite( image )
SetSpriteSize( s, Width, Height )
SetSpritePosition( s, 0, 0 )
Render()
i = GetImage( 0, 0, Width, Height )
DeleteSprite( s )
endfunction i
"



https://forum.thegamecreators.com/thread/218320#msg2591684
puzzler2018
User Banned
Posted: 7th Dec 2018 20:49
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 8th Dec 2018 15:53
Hello Puzzler

I indeed saw those corrections, but the thing is, I already use those coorecections. Could there be something wrong with the image I'm using?

PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 9th Dec 2018 17:27
This post has been marked by the post author as the answer.
I also got the same error when I tried Scraggles code and not knowing memblocks very well I decided to go my own way

Not very elegant but it works for all my needs, I build the desired image with sprites, grab the output and clear up returning the image id
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 10th Dec 2018 08:43
Wow man, thanks a bunch.
Your code works without a hassle. Big props for you!
Scraggle
Moderator
20
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 11th Dec 2018 13:28
Hey,

I've just seen this. You should have sent me a PM, I would have been able to reply straight away.
I'm not sure precisely what the issue is that you're having but it seems you have working code now so I'll leave it.
Everything works for me but I may have tweaked the code a little since I released it.

Scraggle
PartTimeCoder
AGK Tool Maker
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location: London UK
Posted: 11th Dec 2018 17:40
Hi Scraggle

The code generates an error when calling SetSpriteSize9Slice()

the code I am testing


and error screenshot attached

Attachments

Login to view attachments
Carharttguy
7
Years of Service
User Offline
Joined: 8th Jul 2016
Location: Belgium
Posted: 11th Dec 2018 19:08 Edited at: 11th Dec 2018 19:09
Yeah Scraggle

I would really like to get your code working, you can see my 'project' in the first post, that generates the error. It's actually very simple, it takes a 50x50 box and I try to stretch it.
My error is exactly the same as PartTimeCoder (ofcourse the offset values are different)

Thanks for jumping in!

Login to post a reply

Server time is: 2024-03-28 22:09:10
Your offset time is: 2024-03-28 22:09:10