Crazy Golf

Alexin

  • *
  • Posts: 3132
I think it's because the collision shape is concave. Split it into 4-5 separate pieces: 1 for each sail and optionally 1 for the center. They must be convex, ie. if a line intersects the shape, then it only does so twice.

Another subject for Stencylpedia...
"Find the fun"
alexin@stencyl.com

Jon

  • *
  • Posts: 17524
That definitely needs documentation and perhaps even a mention in the UI itself when you craft polygons if we aren't already doing it. If you'll do it, let us know. It's a brief thing and doesn't need to be elaborate. Just a picture or two (concave -> convex version) and a couple sentences.

RandomJibberish

  • Posts: 82
Thanks, it's working nicely now. Some kind of warning inside SW against using concave shapes would be useful, to stop the same thing happening to anyone else :P

I'm working on a snippet to stop the ball jamming behind the sails and crashing the game, but it's not working and I reckon I'm using the wrong approach. Here's what I have at the moment, in a snippet attached to the windmill sails:


« Last Edit: April 11, 2011, 10:51:11 am by RandomJibberish »

Alexin

  • *
  • Posts: 3132
First, you should check if the collision occurred with the ball before using Last Collided Actor, just to be sure. Second, you probably want the logic above to run once, so you'll have to add a boolean that tells you that. Finally, it seems you want to the logic to run when the ball isn't moving. However, checking if its speed is exactly 0 isn't a good idea. Compare the absolute value of the speed using a small and adequate threshold.
"Find the fun"
alexin@stencyl.com

RandomJibberish

  • Posts: 82
Thanks, Alexin. I've messed with some stuff and it should be pretty impossible to get stuck now.

Is there any way to adjust the linear damping of an actor in different regions? I've added water and it works well, except that it's pretty awkward that "water resistance" is the same as "air resistance" - atm it's just a gravity change.

Alexin

  • *
  • Posts: 3132
Put the following code in a code block:
Code: [Select]
actor.getBody().SetLinearDamping(SOME_VALUE);

Replace SOME_VALUE by the internal name of a Number attribute, if you use one.
"Find the fun"
alexin@stencyl.com

RandomJibberish

  • Posts: 82
Thanks again, Alexin, that code works beautifully.

Published with levels 7-9 added, including the obligatory windmill stage and a couple of levels including water. I'm a little iffy on the exact gravity and dampening change underwater, so any suggestions for changes to these values would be welcome.

Alexin

  • *
  • Posts: 3132
Nice job!

A couple of things:

- It isn't obvious, at first, the ball collides with the windmill and not only with the sails.
- It looks like it isn't possible to score a Hole in One in the windmill stage (or it really is hard).
"Find the fun"
alexin@stencyl.com

RandomJibberish

  • Posts: 82
Mm, I'll add some of the tutorial text at the bottom to make sure it's clear what to do.

and sure it's possible ;)


Alexin

  • *
  • Posts: 3132
I can't figure out how...
"Find the fun"
alexin@stencyl.com

RandomJibberish

  • Posts: 82
Get the ball on top of a sail and just wait. It tips off into the corner right next to the hole but the next sail knocks it in.

Alexin

  • *
  • Posts: 3132
[...] the next sail knocks it in.
Of course it does. >_<
"Find the fun"
alexin@stencyl.com

Epic428

  • Posts: 1118
I love the Windmill! and with the taste for the additional levels, I can see this being a great game!
James Moore - Official Support & Documentation.
We cannot and will not respond to PM's asking questions. Please make a new thread in the forums if you have any questions, Thank you.
For better support and faster response times, please post your logs regarding any Stencyl related issues. Debug > Logs > Generate Logs

Jon

  • *
  • Posts: 17524
Good improvements. The water mechanic could use some fine-tuning, but the last 3 levels show promise in the level design and where you can take this idea.

One thing I caught: The arrow paints below the pink panels.

« Last Edit: April 11, 2011, 07:28:15 pm by Jon »

RandomJibberish

  • Posts: 82
Mm, to move the arrow in front of the panels properly I need to be able to change the layer of the lines I'm drawing. Is this possible?