GameSalad

Looking for a sling shot action for a golf game – Anyone know of tutorial?

Village+IdiotVillage Idiot Posts: 485Member, PRO
edited February 27 in Working with GS (Mac)

Hi Y'all. I'm attempting to make a golf type game where the player drags back from the ball to generate the shot strength and direction. Does anyone know of a tutorial or template? Any help would be greatly appreciated.

I found this: http://gshelper.com/product/pro-golf-18-hole-ipad-template-art-included/
It has the action I'm looking for – I'm guessing it's quite old, would it be ok? Or does anyone know of anything better?

Comments

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    no-one knows of a tutorial?

  • imjustmikeimjustmike Posts: 450Member

    GameSalad comes preloaded with Big Top Blaster (at least on Mac) which is basically what you want, with a few modifications.

    You control a cannon by dragging your finger - the further away from the cannon the more power it has, and the 'height' of the touch point controls the trajectory.

    That would be a good starting point.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO
    edited February 28

    Thanks – Just checked it out.. and that is the sort of action I'm looking for. Do you know of any tutorials?

  • imjustmikeimjustmike Posts: 450Member

    Found this in Google - too long for me to go through but looks like the rules will be in there:

    BUT, the rules and behaviours are REALLY well commented in the Big Top Blaster - you'll probably be able to work out how it's all working just by looking through the project

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    Thanks heaps Mike.. I found this too, but thought it might be too old. I'll go through it anyway, as there seems to be nothing else. I didn't realise that Big Top Blaster was commented. I'll go through that as well.

  • jamie_cjamie_c ImagineLabs.rocks Posts: 5,315Member, BASIC

    The tutorial above is old, but it also doesn't really use a sling shot method it's more of a gun shot. Even though it's old all of the behaviors and actions should still work fine.

  • imjustmikeimjustmike Posts: 450Member

    Oh balls, you're absolutely right @jamie_c.

    Still, the Big Top Blaster is still a good starting point

  • SocksSocks London, UK.Posts: 12,725Member

    Here's an old project, might be useful, click and drag on the screen . . .

  • SocksSocks London, UK.Posts: 12,725Member
    edited March 1

    P.S . . .

    "the player drags back from the ball to generate the shot strength and direction"

    The process is easy enough.

    1) when mouse button is down, or touch is pressed - then record mouse X and Y

    2) when mouse is released calculate vectorToAngle and magnitude using the current mouse X and Y and the recorded X and Y.

    3) send the ball off in the direction given by the angle calculation - and at the speed given by the magnitude calculation.

    4) Done !

  • Village+IdiotVillage Idiot Posts: 485Member, PRO
    edited March 1

    thanks @Socks – I like the name of the file. New colour for your cube – a change is as good as a holiday :)

    I don't know if you remember all of my inane questions that I've posted here over the past couple or few years now.. but they've come to fruition and my game – that I've been working on all this time is actually finished, has a trailer and is approved by Apple! Soon I will make it known within the realm of my fellow GS people and we can all sigh together!

    I think I should do that tutorial that's up on GS help about getting to know and love the expression editor – because I STILL find all of that stuff that you seem to comprehend so naturally, to be mind frying.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    Hi again. I've got this template called Golf Pro and I'm trying to work out how it works with my pea brain. I've noticed this thing which spins around the golf ball anti clockwise once you click then drag in order to make a shot. I've looked inside the actor which makes this circle but can't understand what makes it spin – and in that direction. I know angular velocity determines the speed at which it turns, but the direction? Can someone please help?

  • imjustmikeimjustmike Posts: 450Member

    Is the actor on the scene unlocked with other behaviours?

  • Village+IdiotVillage Idiot Posts: 485Member, PRO
    edited March 9

    no, it gets spawned

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    have uploaded the template..

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    you'll find another circle actor which I can't work out what it's doing

  • SocksSocks London, UK.Posts: 12,725Member

    @monkeyboy simian said:
    can't understand what makes it spin

    Angular Velocity.

    @monkeyboy simian said:
    and in that direction.

    The Angular Velocity is set to 100, which is 100°/sec CCW.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    @Socks I can't see where it's stating CCW. I've attached a grab of where I'm looking. As far as I can determine, there's nowhere else to look as the actor is spawned and there's no instance of it on the scene.

  • SocksSocks London, UK.Posts: 12,725Member
    edited March 11

    @monkeyboy simian said:
    @Socks I can't see where it's stating CCW.

    In the world of maths angles increase counterclockwise.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    oh.. Thanks @Socks I was never good at maths.. nice flashy arrow. Just think of me as the mentally challenged one sitting in the corner drooling.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    although, I suspect by now, you already do..

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    PS: I noticed that your cube was this colour years ago. You got sick of the green?

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    @Socks I think I'm going to have to look this stuff up. Do you know of any sites that might explain this for remedial types like me?

  • SocksSocks London, UK.Posts: 12,725Member

    @monkeyboy simian said:
    oh.. Thanks @Socks I was never good at maths.. nice flashy arrow. Just think of me as the mentally challenged one sitting in the corner drooling.

    :)

  • SocksSocks London, UK.Posts: 12,725Member

    @monkeyboy simian said:
    PS: I noticed that your cube was this colour years ago. You got sick of the green?

    I didn't change it, the colour is decided by a team of wizards, they email me a new cube every 314.159 days.

  • SocksSocks London, UK.Posts: 12,725Member
    edited March 11

    @monkeyboy simian said:
    @Socks I think I'm going to have to look this stuff up. Do you know of any sites that might explain this for remedial types like me?

    Just ask here, at the least you'll get an explanation that relates to GameSalad.

    All this stuff is pretty straightforward, a bit of experimentation will - very quickly - show you what Angular velocity is doing, the value field is how many degrees the actor rotates in 1 second, if you changed it to 50 it would have slowed down, change it to 2000 and it goes much much faster, change it to -200 and now it's rotating at minus 200°/sec, which is CW . . . etc etc . . .

    I personally know all this secret esoteric knowledge :p :) because when I was in the same situation I pressed a load of buttons, and tried a bunch of values and took a look at what happened, I could see that 360 made the actor do a complete rotation in 1 second, a value of 36 made the actor do a complete rotation in 10 seconds . . . so I concluded that was how the speed value must be set up - as degrees/sec - it took a couple of minutes or so to arrive at that idea . . . that is to say there is no special math skills required here !!

  • Village+IdiotVillage Idiot Posts: 485Member, PRO
    edited March 11

    I can't imagine you ever being anywhere near my subterranean level. I just tried putting a minus sign in front of the value and it spun the other way.. and it made me smile a nerdy smile :).

    Why would they use angular velocity instead of something like a rotate behaviour? Is it just a case of preference? Or does it improve performance?

    Thanks again @Socks for your sage like wisdom.

  • SocksSocks London, UK.Posts: 12,725Member

    @monkeyboy simian said:
    I can't imagine you ever being anywhere near my subterranean level. I just tried putting a minus sign in front of the value and it spun the other way.. and it made me smile a nerdy smile :).

    See what joys a little experimentation will bring !

    @monkeyboy simian said:
    Why would they use angular velocity instead of something like a rotate behaviour? Is it just a case of preference? Or does it improve performance?

    They are doing pretty much the same thing, no performance difference. The Rotate behaviour lets you control the speed value with an expression, whereas just typing the value into the Angular velocity attribute field saves you a behaviour . . . so not really much in it.

    Thanks again @Socks for your sage like wisdom.

    Crosses legs, hears a cracking sound, backs out of the whole crossing legs thing.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Posts: 9,895Member

    I built a system using the power meter method like many of the old golf games had.

  • Village+IdiotVillage Idiot Posts: 485Member, PRO

    @The_Gamesalad_Guru Do join have a tutorial on this?

Sign In or Register to comment.