Pants makes a game
Moderator: Forum Moderators
Pants makes a game
As I've mentioned elsewhere, I'm fiddling around with Game Maker 8 in order to try to get a little something together around an idea spawned on the Wave thing. I'm making a thread here about it for three reasons:
1. To remind me what I'm doing when I get too embroiled in a particular thing
2. A diary for those who are interested in the progress of a virtual know-nothing
3. A way of garnering ideas of you guys, initially for solutions to snags I hit from anyone else who might be fiddling with the program, but also for ideas for the game in the unlikely event that I'm actually successful in any way.
At the moment I'm just trying to get something along the line of Tanx working. If I can do that then I'll start playing around with it, putting in different gun and ammo types, and buildings to destroy. Then (like I'll ever get this far) a contruction economy for the artillery and other 'civilisations' to bombard.
Things done:
Destructible terrain, of a manner
Shell trajectory
Tank movement
Tank gravity
Things to do:
Gun sprite angle
Shell sprite angle
Sound effects
Tank damage
Opponent AI
Turn system
User inputted trajectory/power
Problems:
Ground gravity collision not working
1. To remind me what I'm doing when I get too embroiled in a particular thing
2. A diary for those who are interested in the progress of a virtual know-nothing
3. A way of garnering ideas of you guys, initially for solutions to snags I hit from anyone else who might be fiddling with the program, but also for ideas for the game in the unlikely event that I'm actually successful in any way.
At the moment I'm just trying to get something along the line of Tanx working. If I can do that then I'll start playing around with it, putting in different gun and ammo types, and buildings to destroy. Then (like I'll ever get this far) a contruction economy for the artillery and other 'civilisations' to bombard.
Things done:
Destructible terrain, of a manner
Shell trajectory
Tank movement
Tank gravity
Things to do:
Gun sprite angle
Shell sprite angle
Sound effects
Tank damage
Opponent AI
Turn system
User inputted trajectory/power
Problems:
Ground gravity collision not working
Last edited by Dog Pants on May 22nd, 2010, 14:10, edited 3 times in total.
I've got gravity working thanks to a patchy official tutorial on platform games. I'm now trying to get the thing to climb slopes, with no success.
If anyone's interested I'll try to keep the GMK file updated here so they can poke at it.
If anyone's interested I'll try to keep the GMK file updated here so they can poke at it.
-
- Site Owner
- Posts: 9597
- Joined: May 16th, 2005, 15:31
- Location: Coventry, UK
- Contact:
Quick fix:
In the step event on the tank, the position check should be 0,1 and relative to check it's in the air for the gravity. It was sticking to the terrain.
The L and R slope objects should both have the grass set as their parent, so the collision is inherited from the grass and the tank doesn't fall through them.
The slopes are a little steep for the ±4,-8 relative collision check - I had to use 4,-9 for right and -4,-12 for left. Those events should also be Keyboard, Left and Right, not Key Press.
Proper fix:
The reason for the difference between left and right, is that your sprites have their origin set at 0,0 (the top left) instead of their centre.
The ±4,-8 check could work if you centred all the origins and manually gave the L & R slopes a bounding box of 0,15,8,15 (L,R,T,B), although you'd have to avoid using two in a row - the ±4,-8 check is for steps no bigger than 8 pixels, two half-steps (slopes) in a row is 16 pixels. The tank sprite needs a little tweaking as it's asymetrical.
Elegant fix:
A workaround for the slopes would be to remove the parentage of the L & R slopes and create two new, invisible objects in the shape of the grey area below (and its mirror):
Then make the grass parent of these invisible steps and draw them on top of where you have slopes.
In the step event on the tank, the position check should be 0,1 and relative to check it's in the air for the gravity. It was sticking to the terrain.
The L and R slope objects should both have the grass set as their parent, so the collision is inherited from the grass and the tank doesn't fall through them.
The slopes are a little steep for the ±4,-8 relative collision check - I had to use 4,-9 for right and -4,-12 for left. Those events should also be Keyboard, Left and Right, not Key Press.
Proper fix:
The reason for the difference between left and right, is that your sprites have their origin set at 0,0 (the top left) instead of their centre.
The ±4,-8 check could work if you centred all the origins and manually gave the L & R slopes a bounding box of 0,15,8,15 (L,R,T,B), although you'd have to avoid using two in a row - the ±4,-8 check is for steps no bigger than 8 pixels, two half-steps (slopes) in a row is 16 pixels. The tank sprite needs a little tweaking as it's asymetrical.
Elegant fix:
A workaround for the slopes would be to remove the parentage of the L & R slopes and create two new, invisible objects in the shape of the grey area below (and its mirror):
Then make the grass parent of these invisible steps and draw them on top of where you have slopes.
Blimey, cheers FJ. Some useful things to know there.
Damn, just one missed tickbox. I didn't think of checking the step action.FatherJack wrote:In the step event on the tank, the position check should be 0,1 and relative to check it's in the air for the gravity. It was sticking to the terrain.
I need to do some research into parent objects. Presumably the child would inherit all properties from the parent.FatherJack wrote:The L and R slope objects should both have the grass set as their parent, so the collision is inherited from the grass and the tank doesn't fall through them.
That's good, it means I was along the right lines, just didn't have the right values. I'd copied it from a platform game, but obviously the slopes were different because I'd made them myself. My fault for making gash placeholders instead of doing them properly.FatherJack wrote:The slopes are a little steep for the ±4,-8 relative collision check - I had to use 4,-9 for right and -4,-12 for left. Those events should also be Keyboard, Left and Right, not Key Press.
For some reason the coordinates of the jump moves and collision checks were confusing me, despite me knowing it was pretty simple. I think it's because I had no point of reference. I was fiddling with the values working on the assumption that my blocks might be a different size to the ones in the tutorial I was following, but as I was getting no success whatever values I tried I could never tell if I was on the right lines.FatherJack wrote:The reason for the difference between left and right, is that your sprites have their origin set at 0,0 (the top left) instead of their centre.
The ±4,-8 check could work if you centred all the origins and manually gave the L & R slopes a bounding box of 0,15,8,15 (L,R,T,B), although you'd have to avoid using two in a row - the ±4,-8 check is for steps no bigger than 8 pixels, two half-steps (slopes) in a row is 16 pixels. The tank sprite needs a little tweaking as it's asymetrical.
I like this. Having blocks to jump rather than a slope to negotiate makes a lot more sense for the time being.FatherJack wrote:A workaround for the slopes would be to remove the parentage of the L & R slopes and create two new, invisible objects in the shape of the grey area below (and its mirror):
Then make the grass parent of these invisible steps and draw them on top of where you have slopes.
I finally got slopes working. It's still a bit ugly (sometimes it takes a few attempts to get up a hill), and for some reason the tank has gravity-style lateral acceleration, but it works well enough for now. I also managed to get the shells to take out a larger section of ground. It's a bit hit and miss, sometimes taking out one square, sometimes taking out loads, but I kind of like that. I've also given the ground squares gravity so that earth falls down when the squares below it are destroyed. Unfortunately at the moment they don't stop...
thats probably because they have nothing to stop themDog Pants wrote:. I've also given the ground squares gravity so that earth falls down when the squares below it are destroyed. Unfortunately at the moment they don't stop...
you could add another floor so when the earth falls it is destroyed upon hitting that floor so it doesnt get cluttered
That's not the problem. They sit on top of each other properly until a lower one is destroyed, then all the ones above fall off the bottom of the screen. I've got a line of non-gravity blocks at the bottom (which should be indestructible but aren't) to stop them all falling, but they don't seem to like stopping after they drop. I've uploaded a new version for the link up there.
-
- Site Owner
- Posts: 9597
- Joined: May 16th, 2005, 15:31
- Location: Coventry, UK
- Contact:
Instead of using gravity on the grass object step event, replace it with a Move To Contact action on Self, Direction 270, Maximum -1, Against solid objects. You don't then need the Else where you turn the gravity back off.Dog Pants wrote:That's not the problem. They sit on top of each other properly until a lower one is destroyed, then all the ones above fall off the bottom of the screen. I've got a line of non-gravity blocks at the bottom (which should be indestructible but aren't) to stop them all falling, but they don't seem to like stopping after they drop. I've uploaded a new version for the link up there.
This is more efficient as it affects only the blocks, gravity would affect the tank too.
I'd been trying move to before and it wasn't working. Changing it from the create event to a step event works though. It seems to be checking a lot though as the framerate has plummeted. Not a problem for now - I'll just have it check at the end once I impliment turns.
Next up, setting firing angles/power. Simple in theory - take the values for the direction and speed of the shell at creation from a user inputted text box. I've not worked out how to set variables yet though.
Next up, setting firing angles/power. Simple in theory - take the values for the direction and speed of the shell at creation from a user inputted text box. I've not worked out how to set variables yet though.
Ooh, found a useful beta demo someone posted. Even better, they posted it so that people can use it to help with their games. It's all done using scripts, which I always suspected would be the better way but would require me to learn the code. Doesn't look too difficult.