Gravity question (how to make actor bounce)
Ozzy25
Member Posts: 15
Hello!
I just got GameSalad today and so far I'm having much fun with it.
I've read almost all of the manual, actually I'm at the part with scene attributes, where I read about the gravity attribute. I thought it would be cool to make my player jump, a bit like in Doodle Jump, you know?
I tried changing the value, but all it does is making my background image slide away (where the speed on how quickly it slides away depends on the value I set, the higher it is, the faster it disappears).
So this is nothing like what I would have hoped for. But obviously it's more work than that…
I've tried doing some research on here and searching various terms such as "gravity", "bouncing" or "jumping" but I couldn't find what I need, also all stuff I read is way too advanced for me. I also searched on the Youtube channel
Could anyone be so kind to explain me or link me to a tutorial perhaps, on how to make the player / actor bounce?
Thanks guys, would greatly appreciate it!
Ozzy
I just got GameSalad today and so far I'm having much fun with it.
I've read almost all of the manual, actually I'm at the part with scene attributes, where I read about the gravity attribute. I thought it would be cool to make my player jump, a bit like in Doodle Jump, you know?
I tried changing the value, but all it does is making my background image slide away (where the speed on how quickly it slides away depends on the value I set, the higher it is, the faster it disappears).
So this is nothing like what I would have hoped for. But obviously it's more work than that…
I've tried doing some research on here and searching various terms such as "gravity", "bouncing" or "jumping" but I couldn't find what I need, also all stuff I read is way too advanced for me. I also searched on the Youtube channel
Could anyone be so kind to explain me or link me to a tutorial perhaps, on how to make the player / actor bounce?
Thanks guys, would greatly appreciate it!
Ozzy
Comments
Hope this helps.
My GameSalad Academy Courses! ◦ Check out my quality templates! ◦ Add me on Skype: braydon_sfx
You need to switch 'movable' off on the actor you don't want to be effected by gravity.
Most people don't bother with gravity and use 'accelerate' (downwards) instead.
I'll make sure to check out those tutorials
I tried using the accelerate but now comes the second problem already. My player basically gets outside of the window / image. For every move (left, right, up, down) I have set an attribute self.Position X and self.Position Y (with > width or < width or > height or < height) so the player never gets outside the picture. This doesn't seem to apply when I use accelerate.
I'd need the same function inside the accelerate box I guess, but the accelerate "rule" box doesn't have such a thing, I can't add any thing of this kind there.
How would I do that? And even if I managed to make it not go outside the screen, I'm pretty sure my player would fall down on the "floor" and stay "sticked" there, no?
Thanks for the help so far
Depending on the style of the game, I'd do what most people do and stick 4 walls on the edges of your playing area to prevent your actor from leaving the scene.
First, my character bounces always higher and higher. That's when the bounciness is set to 1. If I set it to 0,9 or even closer to 1, then it stops bouncing after a short time. How do I make it bounce the same height all the time?
And the second problem is that when I turn left or right, the movement seems to "cut" the bounce. For the controls I have this kind of stuff:
I created a rule with: Actor receives event — key — right key board — is: down
Move attribute: direction = 0,0° (this equals to going to the right) relative to: actor; move type: additive (also tried stacked, see no difference)
Speed: 200
How can I fix that?
Thanks BTW!
So if anyone knows a tip on how to keep the bouncing constant, I'd really appreciate it
And sorry for the double-post people!
Ozzy
Edit // I fixed the constant bounce problem. I set the bounciness to 0.95, it's good now! For the other problem I'll create another thread to not get it mixed up
Here, I've made you a quick endless bounce that is very efficient (only uses a single constrain rule) and always bounces to the same height . . . .
http://www.mediafire.com/?vn14ad8dn3m25m3
I tried implementing it in my project, and I'm having a few problems.
For example when I go hard left or hard right, then it like "sets back" the character to a few millimetres. I'm not sure if you get what I'm saying, it's like if it would lag haha
Also, could you explain a bit what all these things do? :P
I found out that by changed 384 in there >>>> 200*sin(( self.Time *200)%180)+384
… that it would change where the actor basically lands. Could this make some problems if I have different floors later, on a different height?
Also I liked how you changed the width every time it bounces on the floor, that gives a really nice effect I tried "implementing" this as well, but somehow the width is always stuck I can't get to play the sound either?
Sorry… I'm really a newb so I still don't exactly know how to use everything. But I really love that example, very much appreciated by the way
Edit // I think I at least solved the width problem, was because I didn't see the "otherwise" I guess!
http://forums.gamesalad.com/discussion/52030/better-solution-for-an-up-to-down-platform#latest AAA*sin(( self.Time *BBB)%180)+CCC
AAA = height of bounce
BBB = speed of bounce
CCC = the 'floor' (where it lands). Yeah ! Lol. : ) I just thought it might give you some new ideas about how you might go about doing this, you could probably get it to work even with platforms of differing heights (although I've not thought about it so am not 100% sure). I bet Disney/Pixar are worried about the competition.
; P Both should be pretty simple to implement - on any kind of movement system. It gets a lot clearer the more you use the software.
Thanks for the AAA, BBB, CCC explanation :P That's exactly the kind of explanation I need haha!
But I was wondering here: I removed the +384 this time, and now it was just like the very bottom was the floor, but how come it doesn't collide with my floor? My floor is at ⅓ of the height of the screen. I also made sure the collide behaviours come before the constraint attribute one.
This would basically get rid of the future height / level problem, because I'd always land where my floor actor is
How's that for an answer : )
Actually it was in the other thread where I had posted a screenshot of all settings, I thought it might help?
It's all that's been done in the game (plus some wall actors, and a floor).
Still no clue? :P
EDIT // I think the problem is the Accelerate behaviour inside both rules for the left and right move command. Since I replaced the other Accelerate, (that was at the very beginning), I thought I may have to replace these here by the Constrain Attribute behaviour as well? I tried but if I do that it won't move at all.