C.O.C.K. ATTACK

Show off your games, demos and other (playable) creations.
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

C.O.C.K. ATTACK

Post by philnelson »

I've been working a project in TIGsource.com's newest competition, the Cockpit Compo. I'm currently looking for a collaborator to help with the code (esp. GUI elements), and since it's written in Love2d, I thought I'd post here to see if anyone was interested. You can see the status of the project and any mockups here: http://forums.tigsource.com/index.php?topic=4919.0

The (not great) code is available here: http://github.com/philnelson/cock-attack/tree/master
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: C.O.C.K. ATTACK

Post by bartbes »

Just finished reading the other thread. GREAT!!!
Too bad I'm not going to help...

I did read you got LUBE working? Another reason why I should love your game.
Ah.... *just enough reason left to push the submit button*
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

Re: C.O.C.K. ATTACK

Post by philnelson »

Yes! LUBE is working, in fact. Right now it can just send strings back and forth (we implemented a super crude version of IRC basically). I may release that part of the code as a simple demo for LUBE. Once I can figure out a good way to create simple UI buttons and so forth, anyway.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: C.O.C.K. ATTACK

Post by bartbes »

I already implemented IRC once on a hacked-up version of LUBE (it didn't support tcp back then).. well I'll wait and see what becomes of this wonderful mix of acronyms.
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

Re: C.O.C.K. ATTACK

Post by philnelson »

Having a lot of trouble right now deciding on how to create "buttons" and so forth in the UI. I'm interested in how other people accomplish this.

The way I'm doing it is like this, in pseudocode:

Code: Select all

on mouse click
    if the click happened in between these X and Y coordinates
        do this stuff
    end
end
but I'm kind of stumbling w/r/t how to implement this in Love2d with the buttons corresponding to multiple, totally different, screens.
User avatar
qubodup
Inner party member
Posts: 775
Joined: Sat Jun 21, 2008 9:21 pm
Location: Berlin, Germany
Contact:

Re: C.O.C.K. ATTACK

Post by qubodup »

philnelson wrote:but I'm kind of stumbling w/r/t how to implement this in Love2d with the buttons corresponding to multiple, totally different, screens.
My naive answer is: Create an "active" status for each button.

Another tipp: use the physics part of love to use clipping to know if the mouse is over a button at time of press.
lg.newImage("cat.png") -- made possible by lg = love.graphics
-- Don't force fullscreen (it frustrates those who want to try your game real quick) -- Develop for 1280x720 (so people can make HD videos)
osuf oboys
Party member
Posts: 215
Joined: Sun Jan 18, 2009 8:03 pm

Re: C.O.C.K. ATTACK

Post by osuf oboys »

philnelson wrote:Having a lot of trouble right now deciding on how to create "buttons" and so forth in the UI. I'm interested in how other people accomplish this.

The way I'm doing it is like this, in pseudocode:

Code: Select all

on mouse click
    if the click happened in between these X and Y coordinates
        do this stuff
    end
end
but I'm kind of stumbling w/r/t how to implement this in Love2d with the buttons corresponding to multiple, totally different, screens.
I would suggest making the buttons object-oriented by keeping track of where they are, how they are drawn, and when they do when clicked. To assist you with this, you could use one of the existing GUI libraries. I would furthermore make each "screen" object-oriented, defining what UI components there are and how the screen is updated and drawn.
If I haven't written anything else, you may assume that my work is released under the LPC License - the LÖVE Community. See http://love2d.org/wiki/index.php?title=LPC_License.
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

Re: C.O.C.K. ATTACK

Post by philnelson »

What's the deal with Lua and referring to table data in mathematical comparisons? I'm trying to do this

Code: Select all

head_data = {tohit=6}

Code: Select all

tohit_roll = math.random(1,20)
if head_data.tohit <= tohit_roll then
    do stuff
end
but I get an error that says I'm trying to compare a number to nil. I can display head_data.tohit. It is most definitely NOT nil.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: C.O.C.K. ATTACK

Post by bartbes »

Try asserting it all, it might be that the random function somehow fails, give-me-all-errors-you-can-generate code:

Code: Select all

head_data = {tohit=6}
assert(head_data, "head_data == nil")
assert(head_data.tohit, "head_data.tohit == nil")
tohit_roll = assert(math.random(1,20), "math.random(1,20) == nil")
if assert(head_data.tohit, "for loop can't read head_data.tohit") <= assert(tohit_roll, "for loop can't read tohit_roll") then
    do stuff
end
This should tell you what the problem is and where it's located.
philnelson
Prole
Posts: 48
Joined: Sun Feb 01, 2009 3:32 am

Re: C.O.C.K. ATTACK

Post by philnelson »

Ah, I didn't even know about assert. Useful! Thanks.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Amazon [Bot] and 14 guests