Hi
it has come to my attention that Regions are being ignored if player walkspeed set high.
IE:
chero.SetWalkSpeed(12, 12); // Player ignores regions when running over it.
chero.SetWalkSpeed(5, 5); // Player obeys regions when walking over it.
Am I missing something? Is there a solution?
cheers
How wide is your region? If your region is for example 5 pixels wide and your character moves more than 5 pixels at a time, it might be that he is never on the region and that is why events on that region are not triggered. So I think workaround would be to make regions at least as big as the amount the character moves in one game loop or do your own checks on repeatedly execute function to trigger your events.
Could you be more specific what are you using regions for in this case so we could help you with the workaround?
Hi zabnat
I overlooked that, typical. Anyhow, I have increased all the Regions dimensions and have had to redo some of the maths and it seems to do the trick.
What a doughnut :-[
It just goes to show you should never be complacent....
Cheers
I think it would be a nice extension to AGS to handle this properly. The system could check for each step whether there was a region between the last frame and the current one and do some micro-management to walk around the region.
I guess it would lead to increased computation time since every step of a character's walk animation would need to perform this aliasing check, but technically I think it would not be too difficult to implement.
Just my 2 cents.
Honestly I don't see a lot of benefits for interpolating character position between game loops if you use regions for what regions are for. Could somebody give an example where it would be beneficial to have region events trigger between game loops if player has "jumped" over the region?
Exactly, that's why I was waiting for slasher to answer why he'd need regions that thin.
I can imagine something like a burglar walking into a light barrier, but since player sprites are usually at least 10 pixels wide, the region has to be about 20 pixels wide in that case anyway.
In a situation where you'd actually need a one pixel wide line, you can simply use the walks off and walks onto regions events, one for each side.
Khris,
When I added the Regions I forget about if the player is running or trotting and not just walking.
Silly schoolboy error (laugh)
Anyhow, all rectified.
slasher
Sure, but like I said, I'm interested in why you had a region that thin in the first place.
QuoteI can imagine something like a burglar walking into a light barrier, but since player sprites are usually at least 10 pixels wide, the region has to be about 20 pixels wide in that case anyway.
The Regions were around 15 / 18 wide, seemingly wide enough for walking. However, running mode did not obey. Re-sized Regions to around 36 / 42 wide and then they were ok.
Width of character's widest walking part is 34. So Regions in this case would then need to be 34 /38 ?
I will need to remember this for future scenarios.
cheers