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 / Cilmb ladder

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 10th Jan 2014 13:48
Hi.

I wrote a code when the player collide with ladder sprite and VirtualJoystickY is move up can climb the ladder. but I want when release the VirtualJoystickY, stay at latest position on the ladder.
But I don't know how can do it.

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jan 2014 14:03 Edited at: 10th Jan 2014 14:06
u can set the velocity y to 0
if you want climb up u speed up y.
maybe u can use a impulse or force for movement.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 10th Jan 2014 14:14
could you show me your mean?
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 10th Jan 2014 17:37
You need to either use a tolerance or the built in "dead zone" in the virtual joystick:


oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 10th Jan 2014 21:46
it's did not make a difference.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jan 2014 22:17
if you set a Velocity, you need also brake i think.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 11th Jan 2014 10:13
Once you apply velocity, the sprite will continue forever, until you stop it (I think this is what Markus is saying too)... Using just your snippet as an example, a simple method would be as follows;



This is an example using your snippet only, this may not work with the rest of your code as I haven't seen it... You may need to tweak a couple things, but this gives you the idea.
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 16th Jan 2014 08:42 Edited at: 16th Jan 2014 09:17
Thanks

also I add this line for stand on the ladder and don't move down.



But somtomes SetphysicsGravity (0,0)the problem will occur. mean before climp the ladder if I push a box sprite then climb the ladder, the box sprite Glide.

This is my full code and Sprites. Please Help me to fix some Problem.

Attachments

Login to view attachments
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Jan 2014 09:29
i will take a look...

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 16th Jan 2014 10:13
Thanks Markus
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Jan 2014 15:42
it seems if you set the y velocity to 0 at the ladder the gravity applies later.
i do a call with up force to make the gravity =0 at stay at ladder.



AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 16th Jan 2014 18:30
what is this???
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Jan 2014 19:15 Edited at: 16th Jan 2014 19:21
interesting for you is only


the abs > i had done because the alien schould not go up/down at ladder border.



alternate you can disable the gravity and simulate it for all
objects self with a force if you need.
means then you can skip the down force if the alien should stay at ladder.
the problem is then the physics objects not goto sleep mode.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 16th Jan 2014 19:56
Markus can you give me final code?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 16th Jan 2014 20:13 Edited at: 16th Jan 2014 20:15
the code snippet before was working as example.
there i had replaced the state with flags.

for a better jump and run u need also to know if the player is
in air or at ground or elsewhere.

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 16th Jan 2014 21:05
I think you are kidding me with this code:



and I don't fix any problem in your code.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Jan 2014 09:01
Behdadsoft, you are being disrespectful. I'm not sure if it's on purpose or not but Markus is a valued member of this community who knows what he is talking about. Please take the time to read everyone's responses carefully and don't expect people to just give you the full working code you are looking for.

The most important thing here is that you try to learn rather than try to get the working codez as fast as possible. If you don't read carefully you will not learn and it will become frustrating for everyone.

oct(31) = dec(25)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Jan 2014 10:22 Edited at: 17th Jan 2014 10:25
@Behdadsoft
you want
Quote: "release the VirtualJoystickY, stay at latest position on the ladder."

that works with my example.
i did not said you should use compleate, just one row u need at least.
did you use same agk version i used?
did the player still moved from self at ladder after release?

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 17th Jan 2014 10:55
Quote: "
Markus is a valued member of this community
"


I know baxslash.

Quote: "
Behdadsoft, you are being disrespectful
"


I do not disrespect anyone. at this forum all is my friends.

Quote: "
Please take the time to read everyone's responses carefully and don't expect people to just give you the full working code you are looking for.
"


I take a time and read Markus code. but I see my code is 107 line and there is some problem. and i ask to help me for fix the Problems. and I say what is the problem at Post 8, then give full code with sprites for everyone that can help me.
now Markus (thank you for help) give me a another code with 120 line and an unexpected things. I tell what is my problem and now I see funny code with More Problems.

Quote: "
If you don't read carefully you will not learn and it will become frustrating for everyone.
"


yes, if I don't read carefully I will not learn and it will become frustrating for everyone. and if everyone don't read carefully before Answer Working with AppGameKit will become frustrating for everyone. because We conclude that the person does not know the solution.

Quote: "
and don't expect people to just give you the full working code you are looking for
"


I don't want Full code. I tried write custom code but always I don't know anything and need question for learn some things. but i do not expect give me not good answer because will become frustrating for me. AppGameKit is no have good example and document for good understanding. I don't know? other engines like AndEngine, CoronaSDK and ... have good video and book tutorials. realy I'm sorry bought AppGameKit because $ 320 was for me. and see it no have good support and good document.

Thanks.
baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Jan 2014 11:46 Edited at: 17th Jan 2014 11:48
Quote: "I'm not sure if it's on purpose or not"

My point is that you are sounding disrespectful, I'm glad to hear that you don't intend to sound that way.

There are plenty of people trying to help you (myself included) and you reply with answers like "it's did not make a difference." and "I think you are kidding me with this code". That sounds disrespectful. I hope you understand that I am trying to help you by telling you that.

By also saying "Markus can you give me final code? " you sound like you are asking for full working code. Perhaps you forgot you wrote that?

AGK is made by a few developers and is very cheap for what it does. The community and the forum have always been the best source of information for TGC products but yes it would be nice if there were more tutorials. Unfortunately I don't have time to write them any more but a few others are producing tutorials if you look around the forum and the AppGameKit website a little.

As to your problem I just tested Markus's code and it solves your problem perfectly... try this version which does not rely on any images:


oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 17th Jan 2014 11:51 Edited at: 17th Jan 2014 12:05
Quote: "
i did not said you should use compleate, just one row u need at least.
"

Mean this line?
if abs(getspritexbyoffset(Player)-getspritexbyoffset(ladder))>3.0 then LadderCollide=0

but in my code PLayer could stay on the ladder. mys problem is another thing.
"But somtomes SetphysicsGravity (0,0)the problem will occur. mean before climp the ladder if I push a box sprite then climb the ladder, the box sprite Glide.
"
Yes I used AppGameKit 108 (B)19. But I think AppGameKit have big bug because some codes don't work with same AppGameKit version. already I has this problem with another thing.

when I use this code, The player fly at air.

baxslash
Valued Member
Bronze Codemaster
17
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 17th Jan 2014 12:08
You should not be setting gravity to stop your player from falling off the ladder. The correct way to do it is the way Markus has shown you by only setting the velocity of the player sprite if he is on a ladder.

It is not a bug. If you set the gravity to zero it does it to the whole scene, not just one sprite. That is the way the command should work, you are just using it for the wrong purpose.

oct(31) = dec(25)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 17th Jan 2014 16:21
marcus Please give show change at my code and no your code.
I'm confused.
Thanks.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th Jan 2014 19:09
ok,
yes its physics, the player was accelerated in air at end of ladder.
i set a flag and then if not collide at ladder i stop the player.
i used the last code you had showed.




AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 18th Jan 2014 19:09
Thanks marcus. but in your code the Player speed Suddenly becomes too much. and could fly and the box sprite still Slipping.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 18th Jan 2014 21:46 Edited at: 18th Jan 2014 21:47
for speed limit you can use something like this
if abs(getspritephysicsvelocityx(spriteid))<20.0
setspritephysicsforce(...
endif
for box maybe make the mass heavier
setspritephysicsmass

i had set the player shape as circle because he can slide
down from crate.

what did you mean with fly? jump from the ladder?
maybe set a heigher value at gravity for let him fall down faster.
SetphysicsGravity

AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670

Login to post a reply

Server time is: 2024-11-25 02:24:22
Your offset time is: 2024-11-25 02:24:22