Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / making a sprite jump

Author
Message
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 12th Jan 2013 06:45
ok... so I've ben puzzling over this for a week now and would like to know how to make a sprite jump. not just straight up and down, but to the left or the right? I'm just not shure how to do this . I would like the sprite to jump over some objects and to be able to land on platfroms... I'm not shure if I need to start useing some physics or how I should attack the problem?
Bursar
15
Years of Service
User Offline
Joined: 17th Sep 2008
Location:
Posted: 12th Jan 2013 09:42
You have a few options depending your coding knowledge and the effect you want to achieve in the game.

You could go full physics, but it might need some tweaking so that jumping doesn't feel 'floaty'. It also depends on if phsyics are appropriate for your game.

You then have two non-physics way of doing it. The first would be to simply allow the player to keep moving left and right whilst in the jump. They can then control exactly where they land, and can change direction part way through the jump.

The other is fix their left/right movement at the time they press the jump button so that their momentum is carried into the jump. Once they land they're free to move left and right again.
Daniel TGC
Retired Moderator
17
Years of Service
User Offline
Joined: 19th Feb 2007
Location: TGC
Posted: 13th Jan 2013 19:40 Edited at: 13th Jan 2013 19:41
Interpolation is the best move, it allows you to plot a curve or straight line easily. Take a look at the Useful Community Functions project it has several interpolation functions you can use, it will basically allow you to plot a curved point to the top of an arc and down to the bottom again.

http://forum.thegamecreators.com/?m=forum_view&t=193433&b=41
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 14th Jan 2013 05:31
thanks guys... the Community Functions project is a very cool thread...
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 14th Jan 2013 06:40
ok I have to ask, because I do not want to screw this up!!! I down loaded UCF.agc and it says to "Place the UCF.agc file in the root of your project folder" would the that be? The Game Creaters/AGK "the one that has these three folders IDE,Players and Projects"?
MikeMax
AGK Academic Backer
12
Years of Service
User Offline
Joined: 13th Dec 2011
Location: Paris
Posted: 14th Jan 2013 11:34
no .. your PROJECT folder .. where your main.agc is
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 14th Jan 2013 19:17 Edited at: 14th Jan 2013 19:50
got it... but, I've decided to add Functions as I need them...
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 15th Jan 2013 01:39 Edited at: 15th Jan 2013 06:04
are thare any agk tutorials that show the use of Interpolations?

maybe one that shows a jumping sprite useing Interpolation?

I'm just not shure how to implement this...
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 15th Jan 2013 21:01 Edited at: 17th Jan 2013 16:36
I've ben working on this for a few hours now and have a subroutine that compiles but when called it appears to do nothing ... I'm trying to make a sprite jump up and to the rigth and then land back on the ground... every thing compiles and runs but sprite dose nothing when I give it y input...

code calling subroutine


subroutine


*EDIT
please note that variable dirJ is being used to tell if the sprite is faceing to the right or left "I want to be abule to make the sprite jump in both ways"... for now I'm working on going right...

*EDIT
I think I may misunderstand how the Berp works
cryptojoe
11
Years of Service
User Offline
Joined: 27th Sep 2012
Location: Michigan U.S.A
Posted: 16th Jan 2013 18:28 Edited at: 16th Jan 2013 19:01
puzzled over this and worket on it all night still dose nothing
I'm useing the examples from;
http://www.thegamecreators.com/news/2012/07/pardon-me-i-just-berped/

this is the only one I can find...

PLEASE!!! someone hear has to understand the Berp better than me...

*EDIT
I'm posting the main.agc of my game to go with the Code Snippet's above... maybe I've missed something???
ZapMan
11
Years of Service
User Offline
Joined: 1st Feb 2013
Location:
Posted: 2nd Feb 2013 09:26
Ive been trying to do this myself. Im pretty much a noob to dark basic pro, so i was trying to do Something like the following

[ If Spacekey()
sprite 1,x,y - 20,1
else
...
ENDIF]

I dont know if this would even work. the reason i put the "..." was because i couldnt think of anything to add there. My idea was to go straight to the sprite, and just change the y when i hit space, and if i wasnt pressing space, then it would just stay where it is, which is why i put the "else". is this a good way of thinking? or do i need to think outside the IF?

Metric City Police Department
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 3rd Feb 2013 11:22
without physics i use this



shadey
14
Years of Service
User Offline
Joined: 25th Jan 2010
Location:
Posted: 3rd Feb 2013 16:46 Edited at: 3rd Feb 2013 16:51
Doesn't this tutorial show you ?
http://www.appgamekit.com/bitesize-3.php

Sorry if I got the jest of what you want wrong!

Hail to the king, baby!

Login to post a reply

Server time is: 2024-05-06 15:02:58
Your offset time is: 2024-05-06 15:02:58