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] Compose image from smaller images

Author
Message
gosukiwi
AGK Tool Maker
3
Years of Service
User Offline
Joined: 24th May 2020
Location: Argentina
Posted: 26th May 2020 03:15
Hi guys,

So, I'm making a game where I have a tilemap. Basically a bunch of 32x32 images which are rendered into the screen in certain orders and positions. So far I create one sprite per tile (I re-use the images) and position it where it belongs. Then I move each sprite individually when I need to scroll. Performance-wise this doesn't affect the game (yet), but I wonder if there's a better way.

Normally what you do in this case is make a big image, and render the map into that image, and then instead of moving hundreds of small images on each update tick, you just move the big image. I tried investigating about this using AppGameKit but it seems this functionality is not easily supported.

At first I thought using RenderToImage would help, but it only works with draw commands, so it was useless. Then I tried using memblocks too, but creating an image from a bigger one it's not as easy as just iterating over images and copy-pasting it's bytes. I think this could be done this way but I have zero idea about image manipulation in this way.

Is there an easier way to do it? Or has anyone done the hard work and implemented some kind of function which supports this behaviour?

Thanks in advance

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

Go to answer

fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 26th May 2020 03:44
SetViewOffset( x, y )

fubarpk on Itch...………...https://fubarpk.itch.io/
fubarpk on googleplay..https://play.google.com/store/apps/developer?id=fubarpk
gosukiwi
AGK Tool Maker
3
Years of Service
User Offline
Joined: 24th May 2020
Location: Argentina
Posted: 26th May 2020 05:18 Edited at: 26th May 2020 20:20
This post has been marked by the post author as the answer.
Interesting! That does the trick!

Still I wonder if what I want to do is possible, but your solution is more ellegant for this particular case and I've already implemented it

Thanks!

EDIT: For the sake of completion, looks like GetImage does what I was looking for

Login to post a reply

Server time is: 2024-04-25 14:19:28
Your offset time is: 2024-04-25 14:19:28