Introduction:This is the first useful tutorial in the series of Jumbo Platform Tutorial.. Evolve from a noob to pro .
I have selected one of the topics marked Very Advanced to prove that this blog isn't just all about bragging,
So, let's start the real thingy ...
What is this all about and why is it marked 'very advanced'?
|A screenshot from my example game at Game design Practical .. Part1|
1. Steps (marked 1 in violet)
Move vertically and horizontally at the same time...
So, in terms of our game world, both can be handled similarly even though slopes are not continuous..]
2. Inclined planes(marked 2 in yellow)
[Slopes, as you know them...]
[Just to add, straight and sloped surfaces are not distinguished in my approach..
So, plane surface also fall in this category...]
and I spend hours achieving those results with little or no success at all....
So, these are like the special ones for me....
Though I believe that it is quite possible for others to achieve this results within hours and with a different approach, I can guarantee can you one thing...
All these approaches are self-thought, original
and hence it is highly probable that it will never match with any other approach of the same problem you have ever known ...
if you already know how to solve this problem ...
It is quite hard to explain it without this edited version of the previous image ..
Note: All the X-axis and Y-axis referred here considers the image displayed above to be in the first quadrant.. This is not similar to the representation of x-position and y-position in Gamemaker where every object is considered to be in the 4th quadrant..
The checking should be done in this order ->
Start checking from a y-position somewhat below the current y-position of the player whether it is collision-free when the player sprite is placed at that point.
(this 'somewhat' value should be about 5 times the height of the slope sprite)
and continue checking vertically upright (for eg. bottom to top along the blue line in this pic)
until you are equally 'somewhat' above the y-position of the player...
instantly snap the player to that position
and stop the loop..
I have tried to put up a pseudo-code representation here with the concept of maximum slope:
1.Max_Slope=Define the maximum slope that the player will be able to move up along (0 to 90 degrees)
(specifically the height of the (x+Max_Hor) position where it is collision-free when a player sprite is placed at that position [where x is the x-position of the player]...
the place_meeting function of Gamemaker can be used)
(It can be negative or positive)
1. .EXE version
If it appears a bit complicated, read it again slowly and try to understand it...
If still some of the discussions appear unclear to you, feel free to comment... I'm there to help you...