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 / Elevator Problem

Author
Message
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 11:03 Edited at: 5th Dec 2014 11:04
Hi.

I made a Elevator that can move up and move down. but there is a Problem that when the Player Placed on and move to right or left, also Elevator move to right and left with Player.

I add SetSpritePhysicsMass() for fix this Problem that fix it a little. but also there is this Problem. I need know there is any way that only move to one direction (e.g: Y direction) without change another direction (e.g: X Direction)?


this is my code without Player that can move up and down:

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 11:21
Why do you need physics for an elevator? Just move the sprite.

-- Jim - When is there going to be a release?
BuccaneerBob
AGK Developer
14
Years of Service
User Offline
Joined: 18th Aug 2010
Location: Canada
Posted: 5th Dec 2014 11:30
To move a sprite in one Direction, you could use the SetSpriteY or SetSpriteX depending on the axis, or you can also use SetSpritePosition(id, X, Y)

All the sprite commands are available here

http://www.appgamekit.com/documentation/Reference/Sprite.htm

Robert Janes (Samu Games)
http://www.samugames.com/artifact
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 12:05
Quote: "Why do you need physics for an elevator?
"


because the Player should place on.

when I use SetSpritePosition() or SetSpriteY() and run the game, elevator without move up place at to custom location.

JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 13:00
Move the player as well. It's not hard. They are going to move by the same delta.

-- Jim - When is there going to be a release?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 13:11
I can't understand your mean
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 13:53
Your elevator is a sprite.

Your player is a sprite.

Your player gets onto the lift.

Your elevator is at X something, Y something.

Your player is at X something, Y something.

The elevator move up one pixel, so its Y is something - 1

Move the player Y something -1 and it stays with the elevator.

That is very simple. It does not need physics. Very few things need physics.

You are trying to do too much too soon without learning the fundamentals and relying on forum members to fix your code for you.

-- Jim - When is there going to be a release?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 14:34 Edited at: 5th Dec 2014 14:40
Quote: "
You are trying to do too much too soon without learning the fundamentals and relying on forum members to fix your code for you."


really I don't know where is this place in thegamecreators forum that can learn anything.I can't understand for learn what to do. when aks a question all say:
people can't write your code.\

when i try write a code and when have a problem with wrote code say me:

relying on forum members to fix your code for you

I don't know for learn I need Practice or I should sit and pray?

How is it possible when one object have physics can stay another object that no have physic? like this Walk in the air.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 14:39
You should study ALL the examples carefully. And read the Help files. We all have to do this. We have all done it.

-- Jim - When is there going to be a release?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 14:41 Edited at: 5th Dec 2014 14:55
Please show me one example in AppGameKit that relate to my Problem.

Edit: You and some users may years worked with DarkBasic and now working with AppGameKit is easy. you and me know there is no any tutorials like DBPro for AGK. so You do not understand newbie users.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 5th Dec 2014 15:07
Try the sprite collision example. That moves sprites. All you need to do is move a couple of sprites.

I don't think you should use the physics at all, because you do not understand what you are doing, and you are getting confused.

One more time:

A sprite is a small picture. It sits at X (left or right) and Y (up or down).

You move it up or down by changing its Y position.

If you have another sprite which is in the middle of your first sprite and you move BOTH of them on the Y axis they will move together. So the second sprite will seem to be moving with the first sprite.

SetSpritePosition(sprite1, GetSpriteX(sprite1), GetSpriteY(sprite1)-1)
SetSpritePosition(sprite2, GetSpriteX(sprite2), GetSpriteY(sprite2)-1)

Both sprites will move up one pixel.

-- Jim - When is there going to be a release?
Behdadsoft
15
Years of Service
User Offline
Joined: 7th Apr 2009
Location: Tehran-Iran
Posted: 5th Dec 2014 15:40
Thanks JimHawkins.

Now Understand your mean.
CJB
Valued Member
20
Years of Service
User Offline
Joined: 10th Feb 2004
Location: Essex, UK
Posted: 5th Dec 2014 16:13
There are loads of good resources available for learning AGK. Community members will kindly share code and tutorials for other members to use. Why don't you create some from what you have learned? I'm sure there will be plenty of users who'd love to see a "How to make flappy-bird style pipes" tutorial etc.!

Forum search.

Useful threads.

There's also a codebase in your account area (although I've never used it). Might have something useful?

Definitely look at, and learn from, the source-code in the examples.

Use F1! There are tons of good descriptions and code snippets in the help files. Use them!

If you're really stuck and all else fails, ask a new question here. We love a challenge!

Multicoder
AGK Developer
10
Years of Service
User Offline
Joined: 25th Oct 2014
Location: Germany
Posted: 5th Dec 2014 16:29
I recommend this video made by Daniel. This is how I started with AGK.



Yes, I am aware that I sound like a caveman to native english speakers
Pong Clone 2k14 {Android}

Login to post a reply

Server time is: 2024-11-25 13:14:12
Your offset time is: 2024-11-25 13:14:12