GameSalad

Need help moving sprite.

Hi Guys,

I need to move a ball by touching it so if moves to the right then as it starts to slide down a 45 slide it starts to gain momentum and speed.
I am new to game salad but looks great.
Is there any example of code I can view?
thanks

Comments

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

    There are lots and lots of tutorials online that will help you learn the basics of Gamesalad and get started. I have a bunch at the links in my signature below.

  • milkywaystudiosmilkywaystudios Posts: 17Member

    Hi i have had a look but cant seem to work out how to get the basic square to move off the solid platform and then slide down a slide using physics, can anyone possibly do my a quick template top look at and learn from it.

  • KevinCrossKevinCross London, UKPosts: 1,889Member
    edited April 2016

    @milkywaystudios said:
    Hi i have had a look but cant seem to work out how to get the basic square to move off the solid platform and then slide down a slide using physics, can anyone possibly do my a quick template top look at and learn from it.

    A square ball? If you want it to roll then make sure the collision shape is set as circle and not square. Also look at the different physic attributes on each actor.

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

    @milkywaystudios said:
    Hi i have had a look but cant seem to work out how to get the basic square to move off the solid platform and then slide down a slide using physics, can anyone possibly do my a quick template top look at and learn from it.

    Make sure the collision shape for the ball is set to 'circle'.

    Give the ball an Acceleration behaviour, set it to 270° (down) and make it relative to 'scene'.

    Give the ball a rule that says:
    When Touch is pressed
    --Change attribute - Change linear velocity X to 200

  • KevinCrossKevinCross London, UKPosts: 1,889Member
    edited April 2016

    Here's an example of a square sliding down a slide. It doesn't roll. If you want it to roll then change the collision shape to circle.

    In my example I'm using scene gravity.

  • milkywaystudiosmilkywaystudios Posts: 17Member

    Hi thanks for the help, when i say square, basically i have everything stripped down, just getting a sqaure to move right by touch it then slide down a slope using gravity. I am new to gamesalad sorry how would i load in your project kev.

  • milkywaystudiosmilkywaystudios Posts: 17Member

    forgot to save i am on MAC

  • KevinCrossKevinCross London, UKPosts: 1,889Member

    @milkywaystudios said:
    Hi thanks for the help, when i say square, basically i have everything stripped down, just getting a sqaure to move right by touch it then slide down a slope using gravity. I am new to gamesalad sorry how would i load in your project kev.

    I created this project on Windows. I think to open it in a Mac version of GameSalad you need to add the extension .gameproj to the folder. Someone else with more experience with this might jump in and correct me if I'm wrong

  • milkywaystudiosmilkywaystudios Posts: 17Member

    actually, kev, when i get home i will load up my windows PC and take a look buddy thanks

  • milkywaystudiosmilkywaystudios Posts: 17Member

    Okay i seem to be getting somewhere now, i can move by touch to start the sprite moving of and down the ski slope but I seem to be struggling with having the sprite accelerate and follow the slope.
    Basically i need the sprite to move right to leave the platform which i have done, then start to accelerate down the slope, however i want to make the sprite follow the curve at the bottom of the slope to be propelled into the air with the sprite feet always facing the ground.
    is there any tutorials i can read or videos to watch or even an example of a ski type game i watch watch and learn the code.?

    thanks for the help

  • KevinCrossKevinCross London, UKPosts: 1,889Member
    edited April 2016

    @milkywaystudios said:
    Okay i seem to be getting somewhere now, i can move by touch to start the sprite moving of and down the ski slope but I seem to be struggling with having the sprite accelerate and follow the slope.
    Basically i need the sprite to move right to leave the platform which i have done, then start to accelerate down the slope, however i want to make the sprite follow the curve at the bottom of the slope to be propelled into the air with the sprite feet always facing the ground.
    is there any tutorials i can read or videos to watch or even an example of a ski type game i watch watch and learn the code.?

    thanks for the help

    A new feature that has not long been added to GameSalad is custom collisions

    http://help.gamesalad.com/gamesalad-cookbook/2-making-it-better/custom-collision-shapes-2/

    You might be able to create a slope image/actor and then add the custom collision shape to that where the ball would roll around the curve and shoot up like your ski slope example. Without any extra code. Using physics and gravity only.

    Otherwise I'd recommend searching the forum or doing a google search but adding gamesalad in the search term.

  • KevinCrossKevinCross London, UKPosts: 1,889Member
    edited April 2016

    Here's an example with multiple slide actors on the scene to create a curve. I've also added Accelerate on the actor to give it a bit of speed. I set the bounciness of the slide to a high negative number to stop the box from bouncing when it hits the curve at the bottom.

    It's a bit rough and probably not the best way to do a ski slope effect. I'd definitely look at custom collision shapes if I was to try this properly.

    There may also be better solutions without using gravity/physics at all.

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

    @milkywaystudios said:
    I seem to be struggling with having the sprite accelerate and follow the slope.

    How have you constructed the slope, it is simple a slope image applied to an actor ?

  • milkywaystudiosmilkywaystudios Posts: 17Member
    edited April 2016

    Hi, first thanks for the examples and the continued support.
    Okay, basically what I need is to create is a kind of candy cane idea (walking stick) image so I can send a basic sprite (actor) down the long cane the scoop off the end, now the end user will see the image, its probably the only complexed image I will be using but important as I will be re-using it alot throughout the game in different ways sizes ect...
    If I can get the sprite to follow the cane and slope that will be perfect and directed by physicals.

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

    @milkywaystudios said:
    Hi, first thanks for the examples and the continued support.
    Okay, basically what I need is to create is a kind of candy cane idea (walking stick) image so I can send a basic sprite (actor) down the long cane the scoop off the end, now the end user will see the image, its probably the only complexed image I will be using but important as I will be re-using it alot throughout the game in different ways sizes ect...
    If I can get the sprite to follow the cane and slope that will be perfect and directed by physicals.

    How have you constructed the slope, it is simply a 'slope' image that you have applied to an actor ?

  • SLOCM3ZSLOCM3Z Posts: 796Member

    @Socks said:

    @milkywaystudios said:
    Hi, first thanks for the examples and the continued support.
    Okay, basically what I need is to create is a kind of candy cane idea (walking stick) image so I can send a basic sprite (actor) down the long cane the scoop off the end, now the end user will see the image, its probably the only complexed image I will be using but important as I will be re-using it alot throughout the game in different ways sizes ect...
    If I can get the sprite to follow the cane and slope that will be perfect and directed by physicals.

    How have you constructed the slope, it is simply a 'slope' image that you have applied to an actor ?

    :D

Sign In or Register to comment.