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 / sticky wall

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

I made a character that can jump and move to directions.but when player is jump and collide to a wall or sprite, Stick to the wall. how can fix this Problem?

Thanks.

this is an example:

Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Dec 2014 15:42
u overwrite the velocity

//^^
//SetSpritePhysicsVelocity(spr,0,GetSpritePhysicsVelocityY(spr))

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 17:14
Quote: "u overwrite the velocity

//^^
//SetSpritePhysicsVelocity(spr,0,GetSpritePhysicsVelocityY(spr))"


overwrite with witch Line?
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Dec 2014 18:17
u set velocity x to 0 at this line, means it stop left/right

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 18:29
You mean is that when collide to wall set velocityX to 0?
If answer is yes don't work this way.
Scraggle
Moderator
21
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 26th Dec 2014 18:41
He didn't say that is what you should do, he said that is what you are doing.
Yodaman Jer
User Banned
Posted: 26th Dec 2014 18:49


WHY ON EARTH DO YOU HAVE A DO-LOOP INSIDE OF A FUNCTION LIKE THAT?!

Can't you do that check without the loop? All that loop is doing is freezing your program for a split second every time you jump. Jump enough times and your game will appear to have lag, and it will break any other physics updates elsewhere.

Also you are overwriting the velocity, this is probably what you should do:

SetSpritePhysicsVelocity(spr,GetSpritePhysicsVelocityX(spr),GetSpritePhysicsVelocityY(spr)


Haven't you also been told a dozen times that using physics for a platformer is a bad idea since you encounter all kinds of inherent problems, such as this one?


7+ years and counting!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 19:38
Markus Really I don't understand your mean. I have Velocity for Move Player to left and right like this:



if I set VelocityX = 0, Player can't move to left and right.what is your mean?????
Yodaman Jer
User Banned
Posted: 26th Dec 2014 19:42


By setting the VelocityX value to 0, you are telling it to stop moving. That's what he means. So if you're setting the value to 0, THIS IS WHY YOU CAN'T MOVE LEFT OR RIGHT, because you're overwriting the values.

You need to completely drop this from the code, I don't know why you even have it...



If you're looking to add gravity do it another way.

Go read the documentation some more, please. You can't just keep posting a new question every time something doesn't work for you, and you can't expect us to keep giving you code.


7+ years and counting!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 20:12 Edited at: 26th Dec 2014 20:14
I KNOW WHEN VALUE IS 0 PLAYER CAN'T MOVE TO LEFT AND RIGHT.

I ask for the second time:

WHEN PLAYER COLLIDE TO WALL I SHOULD SET VALUE TO 0? RIGHT?
BUT I CHECK IT AND DON'T WORK.

Quote: "you can't expect us to keep giving you code"


I don't aks form you that write code for me. when I ask you or anyone in this topic that Write code for me? Please show me.
Yodaman Jer
User Banned
Posted: 26th Dec 2014 20:22 Edited at: 26th Dec 2014 20:24
Quote: "I KNOW WHEN VALUE IS 0 PLAYER CAN'T MOVE TO LEFT AND RIGHT.

I ask for the second time:

WHEN PLAYER COLLIDE TO WALL I SHOULD SET VALUE TO 0? RIGHT?"


If you had actually bothered to read my entire last post you would have seen I had given you the solution to your problem.

You claim you know that setting to 0 makes the player unable to move. Yet you then ask if you should do it anyway, despite my having provided a fix for you in my last post.

Also take the do-loop out of that function, not only does it freeze your program every time you jump but it's HORRIBLE programming practice!

Quote: "I don't aks form you that write code for me. when I ask you or anyone in this topic that Write code for me? Please show me. "


While you never explicitly asked, in your many dozens of threads you always ask "how do this" or "show me how do this". That's pretty much asking us to program your game for you.

EDIT: And how many times must we say that using physics for a platformer is not the best solution? It overcomplicates a LOT of things in the long run, and gives you problems like you're experiencing now. If you wrote a platformer in the traditional sense, you wouldn't have to worry about resetting velocities or the player sticking to walls. Instead of constantly ignoring our advice and being stubborn, I recommend you actually listen to patient people trying to help you before they decide to not help you anymore.


7+ years and counting!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 20:36 Edited at: 26th Dec 2014 20:37
you said me don't use physics for Platform games.in Elsewhere you said me you see examples?

what is this?:

http://www.appgamekit.com/bitesize-3.php

where is example that show how can make Platform game without Physics?


Quote: "If you had actually bothered to read my entire last post you would have seen I had given you the solution to your problem."


really?

you said me remove this code:



and then you check your solution that is work or no?
Yodaman Jer
User Banned
Posted: 26th Dec 2014 20:43
Actually when I first tried you code it wouldn't even compile because of an extra "endif" you had added.

And yes, the removal of the line lets you move left and right again, so you don't get "stuck" to the wall. But because you're using physics, if you continue to press left or right into a wall then you will still appear to be "hugging" the wall. But yes, I checked out my suggestion, though I really didn't need to because I knew the addition of that line was what was making you not move left or right, which is what made you get stuck to that first wall off to the side.

Quote: "where is example that show how can make Platform game without Physics?"


That example you linked to is for literally the most basic of platformers. It's just a quick demonstration to show the physics commands off, it's not saying you should build an entire platformer based off of it. Though I do understand how it can be interpreted as such.

There are plenty of examples of how to create a platformer without using physics out there, if you just look around.

Is there a reason you're being so stubborn and rude to the people trying to help you?


7+ years and counting!
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 20:55
Quote: "Is there a reason you're being so stubborn and rude to the people trying to help you?"


I only answered you and don't rude.I'm just angry.

Quote: "There are plenty of examples of how to create a platformer without using physics out there, if you just look around.
"


I search in forum and google but can't find anything.
Yodaman Jer
User Banned
Posted: 26th Dec 2014 21:08 Edited at: 26th Dec 2014 21:09
Quote: "I only answered you and don't rude.I'm just angry."


You've been (apparently) rude to other users in other threads, I wasn't just talking about this one. Don't let anger get the best of you, you'll never get far as a programmer if you do!

If you're looking for AppGameKit specific platformer tutorials, you likely won't find any. You'll need to just look up as many tutorials as you can, even if it's made with something like Java you can still get a basic idea of the theories and practices and how they work, and then you can interpret and apply them to AppGameKit code. It really isn't hard once you do it.


7+ years and counting!
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 26th Dec 2014 21:16
emm, a platformer with physics is really special and need some thoughts
or specials.

OT
i tryed also the ladder problem but did not have a ready example.
other problem, u can not jump through ceiling because collision.
and there where the ladder is, is a hole you fall down.

@Yodaman Jer
Quote: "
Also you are overwriting the velocity, this is probably what you should do:
SetSpritePhysicsVelocity(spr,GetSpritePhysicsVelocityX(spr),GetSpritePhysicsVelocityY(spr)
"

get&set the same make no sense.

AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 26th Dec 2014 21:33 Edited at: 26th Dec 2014 21:34
for make my Platform game I only need fix ladder and sticky wall Problem.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 26th Dec 2014 23:03 Edited at: 27th Dec 2014 01:24
Behdadsoft - I'm an old and (sometimes) patient man, but you are beginning to annoy me, and obviously others. Many of us have suggested that you would be better off NOT USING PHYSICS but you choose to ignore this advice and carry on posting all over the forum when you hit a problem.

If you insist on using physics then go away for a month and experiment with all aspects of the physics engine until you are an expert. That's what I would do, and I've been programming for at least 35 years.

You are posting far too often and ignoring advice. You want constant examples and get angry if we don't immediately supply them.

Consequently, I believe you are asking forum members to program crucial aspects of your game. We are not a charity. Please disconnect from the internet for a few weeks, read the documentation, try things out.

We would be full of joy if you posted a message saying - It's working!

-- Jim - When is there going to be a release?
Conjured Entertainment
AGK Developer
19
Years of Service
User Offline
Joined: 12th Sep 2005
Location: Nirvana
Posted: 26th Dec 2014 23:50 Edited at: 27th Dec 2014 00:20
Quote: "get&set the same make no sense."

Yeah that whole else could go.
I saw that in another thread and thought... what the ....reposition it to the same spot??
If you are going to set it at what it already is, then why not do nothing since it is already there.

Quote: "You are posting far too often and ignoring advice. "

lol
Perhaps ignoring it would be better than questioning it, when the questioning is deemed as an argument. Questioning advice is typical for beginners, because they are just trying to understand it better. Sometimes experienced programmers take for granted the intricacies of the logic that now seem second nature to them.

Quote: "Is there a reason you're being so stubborn and rude to the people trying to help you?"

Emotions can easily over-ride logic. Spock is not here to concur, but I am sure he would.

Lots of good advice here Behdadsoft.
Markus may not know English as well as other languages, but it is apparent that he does know BASIC as well as his German. I have noticed that he has been quick to give you help, and that his help has been spot on. You thought he was telling you what to do , when he was in fact pointing out what you did wrong. A simple misunderstanding, so don't get angry or give up, because with the good people here in the forums, you will get the help you need to get some programming skills under your belt.

I don't have any code handy like you are needing for an example either, but I do know that learning from example code is the best way to grasp things when starting out. It saves a lot of time of trial and error, which is what I had to do back in the day, and it sucks. Anyway, if you see anything features of any of the games I post, then let me know and I will be glad to let you see my code for it. Be warned though, while my code is functional, it is probably too sloppy to be a "you should do it this way" technique. My code is more like "you can kinda get that to work, like this". (it sometimes confuses others)

Impetus73
13
Years of Service
User Offline
Joined: 28th Aug 2011
Location: Volda, Norway
Posted: 27th Dec 2014 00:10 Edited at: 27th Dec 2014 00:11
I'm wondering if he is a troll from a competing app making tool... If not, you really should LEARN programming (and better English), before making ANY games with AGK... I have programmed on and off for 27 years, and I still don't know it all.

I tried to help you in another thread, and wished I never did, you are really hard to help.

A solution to your problem, might be to make the character move a bit away from the object they stick to, when they hit, so they does not keep hitting it in a locked loop.

----------------
AGK programmer
Did Amiga / AMOS programming in the 90's.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 27th Dec 2014 03:41
i think set velocity confuse the physics engine.
better use force or impulse.
also friction can hold a object if u press it to a wall.
your edited code:


AGK 108 (B)19 + AppGameKit V2 Alpha .. : Windows 8.1 Pro 64 Bit : AMD Radeon R7 265 : Mac mini OS X 10.10 (Yosemite)
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 27th Dec 2014 15:22 Edited at: 27th Dec 2014 15:23
behdadsoft, here is an example which uses Raycasts to stop the sticky walls. This small example, should illustrate everything you need to get you started with a simple physics platform game (without ladders ). I haven't provided any comments, as its not Christmas anymore, but I'd be more than happy to answer any questions you have, if you are unable to get the answers from the online documentation...

This was done in AppGameKit 1 for you... Just copy and paste this into AppGameKit, you do not need any media.

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 27th Dec 2014 18:00 Edited at: 27th Dec 2014 18:26
Thanks Markus for your help and your example.

Thanks Funnell7 this is good example.

But I have 3 question about below lines:



1- why you create 2 PhysicsRayCastGroup at left and right? why is not 3?
2 - in another part you used:



what is 32 and -18?

3- in another part You used "GetSpriteYByOffset(Character_Spr)" and in Elsewhere used "GetSpriteY(Character_Spr)". why?

Thanks
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 29th Dec 2014 07:06 Edited at: 29th Dec 2014 07:09
@Funnell7

I Understand something about your code. according to below code I understand how can Casts a ray to X direction:





and understand how can cast a ray to Y according to this code:





===============================================================
but can't understand why should cast two ray (RaycastRight[1],RaycastRight[2] or RaycastLeft[1],RaycastLeft[2])

and can't understand if I want cast a ray to X direction why also should cast a ray to Y direction like below code?



Please if possible answer me to better understand how work PhysicsRayCastGroup.

Thanks.

Merry Christmas
Funnell7
13
Years of Service
User Offline
Joined: 8th Sep 2011
Location: UK, England
Posted: 29th Dec 2014 11:06 Edited at: 29th Dec 2014 11:07
Quote: "but can't understand why should cast two ray (RaycastRight[1],RaycastRight[2] or RaycastLeft[1],RaycastLeft[2])"


I have two raycasts, as I like to check both the top and bottom of the sprite (as per Picture A below). If I have only 1 (Picture B), then the sprite will stick once the raycast is no longer touching the platform (as per Picture C).

I treat Raycasts as a single beam (Ray)... Now I believe it is possible to actually create a raycast as per Picture D, which would mean you'd only need one. I use two, purely from preference...



As for the Raycast going in the Y axis, this is to check if the character is touching the ground. If so, I will allow the character to Jump...

I hope that helps...

Attachments

Login to view attachments
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 29th Dec 2014 16:00
Thank you very much Funnell7, Now good Understood

Happy New Christmas.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 30th Dec 2014 15:22
...and a Merry Year.

Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 30th Dec 2014 18:25
Thanks CJB

Login to post a reply

Server time is: 2024-11-25 14:27:17
Your offset time is: 2024-11-25 14:27:17