Nope, I'll keep giving you advice, and you keep exploring, researching, testing, and trying new things... and we'll meet somewhere in the middle.Ummmm do you know any tutorials that could make me know what you are talking about?
or you could just tell me the code and it would make everyones lives less painful, and i can study the code so i know what to do later on
Fps jumping
Started by Demon Zito, Jun 26 2011 07:38 AM
28 replies to this topic
#21
Posted 09 July 2011 - 05:07 PM
#22
Posted 10 July 2011 - 12:10 AM
[/quote]
Well, you know the height of the box... and you know the offset of the camera from the floor.
So if an object like a box has a sprite associated with it that represents its x/y foot print, you can use that to check for x/y collisions just like in 2D.
Then, when you jump, you first want to check if there is an x/y collision using the built in features of the engine. Then you can compare the z position minus the offset from the floor (being the z height of the "feet") to the z height of the object. If the z pos clears the z height of the object, then the object can pass over it (through the x/y position). Otherwise, the player will be colliding with an edge.
[/quote]
I think i know the height...20? and the offset is 20? The box has a sprite associated with it..i think, but what do you mean x/y footprint? "Then when you jump" does that mean i put the code into space event? z position meaning height? minus the 20 from the height??? then the camera can jump over the block?? im just trying to understand exactly what you are saying so i can write the code faster!
EDIT: As long as this gets done by july 15!!!!!!!!!!!!
Well, you know the height of the box... and you know the offset of the camera from the floor.
So if an object like a box has a sprite associated with it that represents its x/y foot print, you can use that to check for x/y collisions just like in 2D.
Then, when you jump, you first want to check if there is an x/y collision using the built in features of the engine. Then you can compare the z position minus the offset from the floor (being the z height of the "feet") to the z height of the object. If the z pos clears the z height of the object, then the object can pass over it (through the x/y position). Otherwise, the player will be colliding with an edge.
[/quote]
I think i know the height...20? and the offset is 20? The box has a sprite associated with it..i think, but what do you mean x/y footprint? "Then when you jump" does that mean i put the code into space event? z position meaning height? minus the 20 from the height??? then the camera can jump over the block?? im just trying to understand exactly what you are saying so i can write the code faster!
EDIT: As long as this gets done by july 15!!!!!!!!!!!!
Edited by Demon Zito, 10 July 2011 - 10:45 PM.
#23
Posted 12 July 2011 - 04:25 AM
Can anyone please help me this is important i really need it done by july 15!!! D:
#24
Posted 12 July 2011 - 04:59 PM
Talking more about this whole jumping onto a box.
Phase 1-- get 2D collisions working...
First thing to do-- take your block sprite and change the sprite dimensions to 20x20 and center the origin. This will allow you to us the sprite as the 2D collision mask (since you set it's 3D size to be 20x20x20.) Also, set the block OBJECT to be SOLID.
Then, center the origin on the camera sprite so we can use its sprite for the same purpose.
In the camera object, add a new execute code block in the END STEP event after the movement resolution.
It would also be a lot easier for most players to use the WASD controls rather than the arrow keys.
Here's a new editable:
SINAZ_help_DemonZito.gmk
Try it, see how the camera reacts to boxes now.
Look at the code, it's simple 2D collision. The next step is to get the camera object to differentiate the heights of objects it intersects... and for that, we'll need to update the scene with a box whose top is at or below the floor...
Stay tuned.
Phase 1-- get 2D collisions working...
First thing to do-- take your block sprite and change the sprite dimensions to 20x20 and center the origin. This will allow you to us the sprite as the 2D collision mask (since you set it's 3D size to be 20x20x20.) Also, set the block OBJECT to be SOLID.
Then, center the origin on the camera sprite so we can use its sprite for the same purpose.
In the camera object, add a new execute code block in the END STEP event after the movement resolution.
colFound2D = place_meeting(x, y, block); //see if the camera intersects with a block
if( colFound2D ){ //if so...
move_outside_solid(direction + 180, speed); //move camera out of any solid objects (blocks) in the opposite direction it contacted it.
}
It would also be a lot easier for most players to use the WASD controls rather than the arrow keys.
Here's a new editable:
SINAZ_help_DemonZito.gmk
Try it, see how the camera reacts to boxes now.
Look at the code, it's simple 2D collision. The next step is to get the camera object to differentiate the heights of objects it intersects... and for that, we'll need to update the scene with a box whose top is at or below the floor...
Stay tuned.
#25
Posted 13 July 2011 - 05:41 AM
I see!! So i changed the boxes so they are in the floor and you just see a green bit showing through..But to jump on a box that is heigher than the floor would also be possible?
#26
Posted 15 July 2011 - 07:23 AM
And i had a look at the 2D collision script and was wondering if it followed a similar structure... one idea i had was :
colFound3D = place_meeting (z, block) if colFound3D move_outside_solid(pitch+180, speed)...
but that didnt work
.. the block is at the level of floor though the camera gets stuck, and so i tried make the block lower down.. but it still gets stuck!!! it is as though the block is still there and the camera is colliding. What is going on!?!?
colFound3D = place_meeting (z, block) if colFound3D move_outside_solid(pitch+180, speed)...
but that didnt work
#27
Posted 17 July 2011 - 05:02 AM
Ughhh the teacher is gonna be mad if i dont do this project!
#28
Posted 17 July 2011 - 05:12 AM
Well, I'm sorry I haven't been able to do your homework for you in time, but I've got deadlines of my own.Ughhh the teacher is gonna be mad if i dont do this project!
I started working on jumping on top of objects, but it requires undoing a lot of your previous work and kind of rebuilding so much object code from scratch.
I can continue to step through solutions, but I'm not able to devote my full time to it... so don't expect time pressures to mean anything to me in this case. If this is going to put you off in some way, then I would offer the advice to avoid biting off more than you can chew when it comes to schoolwork.
In the meantime, I'm working on restructuring your game... but it might turn out that finding you an appropriate tutorial that has already been written may get you closer to your goal faster than our little tutelage here.
EDIT:
In the meanwhile... check out TGG's tutorials:
http://gmc.yoyogames.com/?showtopic=86203
#29
Posted 17 July 2011 - 11:38 PM
lol i wasnt spazzing at you , its just the teacher is phycho
sometimes you think he will hit you!! anyway the tutorials you linked me to look good
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











