You are not logged in.
Pages: 1
so far, i've been making good use of these functions, but one doubt remains: what is the offset origin? sometimes it looks like it is from the base center, others from the hotspot, making these functions somewhat confusing and hard to tune.
Last edited by KZR (2012-05-15 20:53:42)
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
it's always the offset from the hotspot of the object.
Offline
ok that explains why some objects need special settings.
i found a way to walk objects on slopes. the only problem is they use "raw" speed values instead of a calculated velocity based on the angle. and they used to break when they find walls, because i was trying to guess where the offset point was coming from. since this example was made on the fly, i can't tell how it would react to walls until i test it.
it looks like this:
execute "slope_correction" while "(brick_type(direction()*(width()/2), (height()/2)-4)) and (brick_type(0, height()/2)) and ((brick_angle(direction()*(width()/2), (height()/2)-4)<> 90)and ((brick_angle(direction()*(width()/2), (height()/2)-4)<> 270))"
this is the trigger, it should be used in a state with gravity. this is counting with a centered hotspot.
then this is what happens:
state "slope_correction"
{
set_absolute_position xpos() ypos()-1
}
long story short:
while there is a solid non90/270º brick, at a height of 4 pixels from the feet, and immediately in front of the direction the object is facing, the object will move up a pixel. since it is a "while" loop, the change is only visible after no more ground is found at such position, which is in the next frame.
Last edited by KZR (2012-05-16 01:27:53)
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
what if we had a custom object that calculates the brick_*() functions, but also taking into account the angle of the object?
So, whenever you need brick_*() to be adjusted by the angle, you'd call the object instead of the built-in functions.
would that help you?
Offline
well i just made improvements on it. and i'm a bit confused about what you are telling me, why would i need a separate object, when the slope correction is based on an object's own ground contact?
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
well i just made improvements on it. and i'm a bit confused about what you are telling me, why would i need a separate object, when the slope correction is based on an object's own ground contact?
never mind, I think I misunderstood it.
Offline
there is a way to correct this. it is to use a velocity value and use sin/cos functions to calculate x/y speeds based on angle. i might get into that soon.
https://discord.gg/w8JqM7m ---> Open Surge's Discord server
Offline
Pages: 1