• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Drawing sprite multiple different times across the object's width

C

cheezy_squeezy

Guest
I don't really know how to properly describe this so apologies if something like this has been asked before, but I'm trying to figure out how to make a kind of autotiling algorithm I guess? Basically I'm wondering how I can get a wall for example, to be able to draw it's own sprite in it's normal unstretched state multiples times across an object that has been stretched in the room editor. So when I place the wall in the room and increase its image_xscale to stretch it into a bigger platform I want the sprite to be drawn again. I thought about using the object's x coordinate + it's image_xscale in some way but I'm not sure how.

Again, sorry if it's a stupid question, just trying to accommodate for my laziness.
 
C

cheezy_squeezy

Guest
Two main ways to do this:

1) Create a primitive and fill it with a texture.
How: https://docs.yoyogames.com/source/dadiospice/002_reference/drawing/drawing primitives/draw_primitive_begin_texture.html

2) Break it up into smaller instances upon room start. Basically you would get the width and height then enter a loop to create a series of normal sized instances and then destroy the original. Would work well if you used whole numbers when scaling it.
Ah yea, cheers. Appreciate it.
 
Top