Another early tanks game

Show off your games, demos and other (playable) creations.
paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Another early tanks game

Post by paclito » Wed May 20, 2009 9:44 pm

Hi all

I'm trying to make a clone of the wii game 'tanks' where it's from one to four player and the goal is to destruct the enemy tanks.... so...... i've get some of the programs in the forum and i've done something....... not the game :megagrin:

First
The map is made with mappy and exported with the script tolua.lua .... for the script to work, only edit the file mappy.ini and edit one of the custom lines to appear like this:

lua16=tolua.lua

then, copy the script tolua.lua to the luascr directory and reopen the mappy program

I've make the map that is in the love file.

Second
I've get some examples from here nimball, zgeigcopters and anothers and get ideas from them, the result is this frankenstein

for the moment we only can to move the tank (arrow keys) and shot with space bar....... but shot five shots every time..... i've no idea WHY aaaaaaaarg :shock:

someone can help this programmer?

sorry for my english and thank you all, without the examples here, this is not posible to make this little example

Update1: I've forget that the code to 'make' the Walls (up down right left) is'nt 'automatic' jejejee

Update2: I've see when the five shots bump 5 or 6 times.... they cross the walls ;) and there is not more 'boing' 'boing'
Attachments
tolua.lua
extension for mappy to export lua maps
(6.53 KiB) Downloaded 143 times
witanks.love
Pseudo early early clone of the wii tanks
(49.2 KiB) Downloaded 191 times

User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Another early tanks game

Post by Robin » Wed May 20, 2009 9:59 pm

Hi,

I tried your demo. Looks promising, although very unfinished ;). The bullets still behave very odd. Also: they seem to keep bouncing around. You are aware that in the Wii game, the "bullets" (shells, actually) explode on the wall after having bounced once?

Also, your English is not that hard to read. Your code would benefit from more consistent indentation, but that's a separate matter.
Help us help you: attach a .love.

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Another early tanks game

Post by bartbes » Thu May 21, 2009 6:42 am

I think I have an idea of why you fire five bullets, you're probably doing love.keyboard.isDown, right?
But in the time it takes for you to 'tap' your keyboard the code has already executed that five times.
So, if you move that code into keypressed or keyreleased (keypressed is recommended for responsiveness) you only fire once every time you press the button.


AFTER SOME RESEARCH IN YOUR CODE:
I didn't exactly look up why the limit is five, but I guess the rest of my assumptions are correct, I see you just stop firing once the key is released, but start with isDown. (or not with keypressed, so I assume that is isDown)

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: Another early tanks game

Post by CR4SH3D » Thu May 21, 2009 7:45 pm

looking good so far :)

bartbes is probably right about why you cant shoot properly, would be great to see more stuff, good luck
Last edited by CR4SH3D on Sun May 24, 2009 11:41 am, edited 1 time in total.

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Re: Another early tanks game

Post by paclito » Sun May 24, 2009 12:02 am

ok, i'm trying this but still having problems with the shots arggggggggggggggggggggggg.
Now i'v a only shot when key pressed ....... but shots are crazy...... always same angle same direction ....... same all I,m the last 3 days with this brainstorm..... for now my tank only likes to shot 45º from up to down...... only work the 'auto fire'
if space pressed a strange error appears on screen.

UPDATE1:
the super explossion over the tank is my try for make a explosion at the end of canon when a shot occurs (keypressed) ....... still not working you can see :)

Good luck to all coders!!!
Attachments
witanks_v2.love
(54.35 KiB) Downloaded 137 times

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Another early tanks game

Post by bartbes » Sun May 24, 2009 6:24 am

Well, I didn't look at the angle problem, but I do know why your shot errors, in main.lua you call player:shot(), which doesn't have a turret initialized (so tank_turret == nil, as the error says), it should be player1:shot().

paclito
Prole
Posts: 35
Joined: Wed Apr 22, 2009 8:33 pm

Re: Another early tanks game

Post by paclito » Sun May 24, 2009 8:52 am

aaaaaaaaaaaaaaaaaaaaaaaaaarg!!!

I'm seeing this error for 3 days and haven't see aaaaaaaaaaaaaaaaaaaaaaaaaarg!!!
i dream with tanks ... with errors aaaaaaaaaaaaaaarg!!!


thank you!

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: Another early tanks game

Post by CR4SH3D » Sun May 24, 2009 11:58 am

call a function with a time to spanw the explosion only once when space is pressed
as for the bullets im afraid i think theres some complex stuff you have to do with the angle of the turret and x,y coordinates, im not sure what but i vaguely remember something similar from maths

User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Another early tanks game

Post by bartbes » Sun May 24, 2009 11:59 am

I haven't checked your code for this, but have you converted between degrees and radians?

User avatar
CR4SH3D
Citizen
Posts: 67
Joined: Mon Mar 02, 2009 6:00 pm
Location: England
Contact:

Re: Another early tanks game

Post by CR4SH3D » Sun May 24, 2009 12:45 pm

i dont think he would have, is there a tutorial on doing that anywhere? (not neccesarily a love specific one)

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 12 guests