I'm making a mini golf app, and i'm trying to make it where if it's on a color (dark green for rough, med green for fairway, etc.) it will make it go a different speed. Can anyone tell me how to make the color an object so my ball can go slower or faster?
Here's a first attempt:
flog.aia (2.8 KB)
I did not have the patience to create a background image, so I used a few green Balls to secure my color values. I am unsure what happens to color values when the Balls overlap.
The operative part was using a Clock Timer to change Gold Ball speed depending on the color at its X,Y. I left the Origin At Center Attribute of the Golf Ball empty, so its X,Y is not covered by its orange color.
Ty! I honestly don't wanna put image sprites for hitboxes, so I'll try this. I'll let you know if it works!
Also, I think the speed is based on the top layer of what it's on.
I believe the turfs were image sprites, right? Just trying to clarify.
The turfs were Balls, because I have no art skills.
I had an idea for hitboxes (Using polygons), but the polygon won't spawn lol.
might be my internet tho
I forgot to mention that if you have a pre drawn background image you can ask the Canvas for the background pixel color where the golf Ball is.
There is a color block on to break a color into red, green, blue values.
So green is item 2 of the output list, 0 to 255.
From there you need some math to get a speed value.
Fudge around from there.
I tried that at first, but I couldn't figure out how to place it. Brain.exe has stopped working.
Do you have a golf course background image file you can post here, for experimentation?
Don't mind the balls. They for hole and Golf ball
flog.aia (38.2 KB)
I added a Label to show the green color level of the current point, and used those values to guess different speeds for those golf feature zones.
I added some touch and drag to the Golf Ball to get it moving.
How do we know that the ball is in the grass, and not in the air (where it will move faster)?
Maybe it's miniature golf?
perfect if you can add a friction to make the ball slow down.
If the ball can be in the air, therefore travelling faster, you could set a variable (air) based upon: club, shot (e.g. tee off), power of hit, predetermined distance, then when a distance based upon those parameters is reached, unset "air" so that the ball slows according to the grass length.
I already got that part going
I'm trying to make it where
When speed < #, then if on color, set to speed