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.

2D All the way! / Standing straight.

Author
Message
aluseus GOD
19
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 26th Mar 2007 21:57
Can someone please post an example where you detect the pixel on the terrain nearest your characters feet, then rotate him so that his feet are flat on the slope?
I want to make a 2d smg engine, and this is the only code snippet I need!
aluseus GOD
19
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 28th Mar 2007 08:29
sorry for double post, but I need help! It's crucial for me to make an entire game called CG RPG.
aluseus GOD
19
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 31st Mar 2007 02:41
Ok, let's reword what I'm trying to do....
I'm trying to make a sprite face the nearest pixel of another sprite....
I'm new, so I cna't do it...
HeavyAmp
19
Years of Service
User Offline
Joined: 25th Oct 2006
Location: Castle in the Sky!
Posted: 31st Mar 2007 05:51 Edited at: 31st Mar 2007 16:33
Ok this is what I think you might need to do

use the SPRITE COLLISION command to detect what sprite your character is colliding with.

SpriteTouching=SPRITE COLLISION(CharacterSprite,0)

Once you have the number of the sprite you are touching then you get the sprites angle. To do this you need to make sure you are holding each sprites angle to begin with.

eg. Sprite1Angle=90
(However a User defined type would be better for this if you know how to use them)

Then you need to rotate your character to that angle

ROTATE SPRITE CharacterSprite, (The Angle the sprite is touching)

Simplified:
.Make sure you store each sprites angle
.If character is touching a sprite find its angle
.Change your characters angle to the sprite touching it

I can think of several problems you might encounter by doing it this way, like the object touching two sprites at once etc. But best to just try to get that working first.

Edit: or better yet use the SPRITE ANGLE command instead of storing your angles,
aluseus GOD
19
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 1st Apr 2007 03:01
Well, see, I was thinking about if the sprite was curved, but thanks anyway!

I will Learn to rule 2d. Someday...
aluseus GOD
19
Years of Service
User Offline
Joined: 19th Mar 2007
Location: I\'m here. Now I\'m there. I keep moving
Posted: 5th Apr 2007 05:28
I did it! I need eXtends, but whatev.

I make a small line right below him and if that is not completely touching the ground AND you have not already rotated 90 degrees, you rotate!

SOme bugs, but whatev.

I will Learn to rule 2d. Someday...

Login to post a reply

Server time is: 2026-07-06 05:28:20
Your offset time is: 2026-07-06 05:28:20