Reference Specific Point Of An Image?

P

Pretento

Guest
Had trouble googling if this code exist, I need to reference a sprite but a specific point of it.
So my attempt was:
image_index = spr_unit_form1(x+14,y+5); but this is an error, what is the proper way to write this?
(google wasn't helpful)
 

Bearman_18

Member
Image index sets the instances Sprite to be on that image of the Sprite. So setting it to 0 sets the instance to the first image of that sprite. What exactly are you trying to do with this specific point?
 

zendraw

Member
i think he wants somthing like sprite_get_pixel? altho such a function exists its not reccomendet you use it.
 
P

Pretento

Guest
well, I was trying out a round-about way to do unit formation. Make a sprite(dots) of how I want the unit to look, then take each soldier and have them AI-path there way to the points.(wasn't sure how to reference pixels in code) There's probably a hundred better ways to go about this, I'm just trying things cause as long as I've used GM, I only vaguely understand how things work.
 

GMWolf

aka fel666
You could do it with ASCII art.
Create a string like this:
Code:
formation =
"..#..#..#..#.."  +
".............."   +
"#..#..#..#..#."
And then use the string functions to determine what goes where depending on what character is where.

It should be far more efficient, both on CPU and ram.
 
Top