Pants makes a game

Talk on any game/console that doesn't have its own forum, including browser-based games

Moderator: Forum Moderators

Post Reply
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Pants makes a game

Post by Dog Pants »

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
Last edited by Dog Pants on May 22nd, 2010, 14:10, edited 3 times in total.
Baliame
Tremors Worm
Tremors Worm
Posts: 3491
Joined: October 13th, 2007, 23:43
Location: Hungary

Post by Baliame »

I've used GM before, it's really really shit looking back now but it's fun.

Ground needs to be solid. Check for collision between tank and ground, soon as it ends, turn on gravity, when it starts, turn it off. I'll get in on 5punkwave, I can help you with implementation.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

Cool, cheers. Bits has been giving me a few pointers too.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

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.
Baliame
Tremors Worm
Tremors Worm
Posts: 3491
Joined: October 13th, 2007, 23:43
Location: Hungary

Post by Baliame »

Yeah, Game Maker tends to overcomplicate an otherwise simple task of climbing slopes. I'll have to download it again and fuck about with it before I can help with that.
FatherJack
Site Owner
Site Owner
Posts: 9597
Joined: May 16th, 2005, 15:31
Location: Coventry, UK
Contact:

Post by FatherJack »

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):

Image

Then make the grass parent of these invisible steps and draw them on top of where you have slopes.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

Blimey, cheers FJ. Some useful things to know there.
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.
Damn, just one missed tickbox. I didn't think of checking the step action.
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.
I need to do some research into parent objects. Presumably the child would inherit all properties from the parent.
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.
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 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.
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: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):

Image

Then make the grass parent of these invisible steps and draw them on top of where you have slopes.
I like this. Having blocks to jump rather than a slope to negotiate makes a lot more sense for the time being.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

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...
shot2bits
Zombie
Zombie
Posts: 2082
Joined: February 7th, 2005, 17:40
Location: england

Post by shot2bits »

Dog 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...
thats probably because they have nothing to stop them

you could add another floor so when the earth falls it is destroyed upon hitting that floor so it doesnt get cluttered
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

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.
buzzmong
Weighted Storage Cube
Weighted Storage Cube
Posts: 7167
Joined: February 26th, 2007, 17:26
Location: Middle England, nearish Cov

Post by buzzmong »

Are you trying to say that essentially someone has paved over a black hole and you've got tanks capable of destroying the floor fighting on it?

Excellent :)
FatherJack
Site Owner
Site Owner
Posts: 9597
Joined: May 16th, 2005, 15:31
Location: Coventry, UK
Contact:

Post by FatherJack »

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.
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.

This is more efficient as it affects only the blocks, gravity would affect the tank too.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

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.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

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.
Baliame
Tremors Worm
Tremors Worm
Posts: 3491
Joined: October 13th, 2007, 23:43
Location: Hungary

Post by Baliame »

The code is trivial really and there is an extensive reference in the help.
Dog Pants
Site Moderator
Site Moderator
Posts: 21653
Joined: April 29th, 2005, 13:39
Location: Surrey, UK
Contact:

Post by Dog Pants »

Yeah, they're all short snippets and don't look any harder than any other language I've learnt (and subsequently forgotten) in the past. I'll see if I can put some in my version during the week hopefully.
Post Reply