Pages: [1] 2 3 ... 10
 1 
 on: September 07, 2010, 02:03:40 am 
Started by Fistmaker - Last post by george
Could you post your stairs object code here perhaps, there are various ways to move to the next map and we can see what you had in mind.

 2 
 on: September 06, 2010, 10:21:49 pm 
Started by Fistmaker - Last post by Fistmaker
Thank you both for the help. I've added the stairs x and y, but I am not sure how I should make the stairs object correctly... I'm using the template from the libtcod/Python Roguelike tutorial from Roguebasin, and I'm super new to both libtcod and python. I have found libtcod documentation here http://doryen.eptalys.net/data/libtcod/doc/1.5.1/index2.html?c=false&cpp=false&cs=false&py=true&lua=false but I wanted to see if there is any more examples or sites I can check out as I have seen many different functions not listed there in other projects. Example I know MAX_ROOMS is part of libtcod, but I don't know where to find that out. I am having a blast even though I'm not sure exactly what I'm doing yet Smiley . Also, thanks for recommending pastebin, I have no idea how I've never heard/used this before. Here is what i've got so far:
http://pastebin.com/Ddp1cBTq

 3 
 on: September 06, 2010, 07:37:07 pm 
Started by aash29 - Last post by jice
True. Applying Agar's non intrusive philosophy to libtcod would be nice... Something to think about for 1.6...

 4 
 on: September 06, 2010, 01:42:02 pm 
Started by aash29 - Last post by aash29
I succeded, thanks for your guidance! Now I can draw Agar windows on top of libtcod map. I think that libtcod could be improved in this direction, for example, if it didn't hog SDL and allowed for custom event loop, pre-initialized SDL, didn't force the creation of new window.

 5 
 on: September 06, 2010, 11:20:38 am 
Started by Fistmaker - Last post by Teddy Leach
This'll get the stairs inserted into the last room created, it's just the last two lines in this code that you need.

Code:
def make_map():
global map, playerx, playery, stairsx, stairsy

#fill map with "blocked" tiles
map = [[ Tile(True)
for x in range(MAP_WIDTH) ]
for y in range(MAP_HEIGHT) ]

rooms = []
num_rooms = 0

for r in range(MAX_ROOMS):
#random width and height
w = libtcod.random_get_int(0, ROOM_MIN_SIZE, ROOM_MAX_SIZE)
h = libtcod.random_get_int(0, ROOM_MIN_SIZE, ROOM_MAX_SIZE)
#random position without going out of the boundaries of the map
x = libtcod.random_get_int(0, 0, MAP_WIDTH - w - 1)
y = libtcod.random_get_int(0, 0, MAP_HEIGHT - h - 1)

#"Rect" class makes rectangles easier to work with
new_room = Rect(x, y, w, h)

#run through the other rooms and see if they intersect with this one
failed = False
for other_room in rooms:
if new_room.intersect(other_room):
failed = True
continue

if not failed:
#this means there are no intersections, so this room is valid

#"paint" it to the map's tiles
draw_room(new_room)

#center coordinates of new room, will be useful later
(new_x, new_y) = new_room.center()

if num_rooms == 0:
#this is the first room, where the player starts at
playerx = new_x
playery = new_y
else:
#all rooms after the first:
#connect it to the previous room with a tunnel

#center coordinates of previous room
(prev_x, prev_y) = rooms[num_rooms-1].center()

#draw a coin (random number that is either 0 or 1)
if libtcod.random_get_int(0, 0, 1) == 1:
#first move horizontally, then vertically
draw_h_tunnel(prev_x, new_x, prev_y)
draw_v_tunnel(prev_y, new_y, new_x)
else:
#first move vertically, then horizontally
draw_v_tunnel(prev_y, new_y, prev_x)
draw_h_tunnel(prev_x, new_x, new_y)

#finally, append the new room to the list
rooms.append(new_room)
num_rooms += 1

#after that, place the stairs at the last room
stairsx = new_x
stairsy = new_y

As for getting the bloody things working... I'm afraid you'll have to ask someone else.

EDIT: By 'will', I of course mean 'should'. Also, you'll need 'stairs x, stairs y' at the top of this code as well Tongue

 6 
 on: September 06, 2010, 07:04:05 am 
Started by Fistmaker - Last post by george
Hmm, how do you know that generating the map works when you don't see the map drawn?

Also, maybe pastebin will work for pasting the code.

 7 
 on: September 06, 2010, 03:54:43 am 
Started by Fistmaker - Last post by Fistmaker
Hello everyone. I'm brand new to python and libtcod. I've been looking at many posts and I'm very happy with what I've been able to do with libtcod and python with little know how and previous coding experience. (I've dabbled with the Q/VBasic and C/C# etc..) Now where I've run into problems is trying to make stairs to make another level. I've tried to make a stairs object generate a new map when checked, which works, but the map is not redrawn. The FOV updates properly, but not the "new" map that was made.  Here is what I have so far.. ( nothing special )
http://roguelikewithpy.sourceforge.net
(I tried to post it in code tags but was too large)
I took out the stairs object so it will run again, as I am not sure if that is the best way to do it. Also, is there any way I can have make_map() place stairs in the last room generated? Any help would be wonderful!

 8 
 on: September 05, 2010, 07:29:33 pm 
Started by TSMI - Last post by mingos
OK. Use the tabs on the right to access individual nodes if you can't access them directly (applies mostly to nodes that use tabs themselves).

 9 
 on: September 04, 2010, 05:36:45 pm 
Started by newobj - Last post by george
Thanks for that Trget! I use Mercurial on my own projects, but it's got to the point now where I have SVN, Git, Bzr, etc. all on my system just so I could easily checkout other projects, and it'd be nice to consolidate that somewhat Smiley.

 10 
 on: September 04, 2010, 02:53:38 pm 
Started by newobj - Last post by Trget
Just to throw out some extra information.

I'm currently pulling the libtcod library's svn repo into a mercurial repo on my machine (see the attached screenshot), and before that I used to work with Subversion repositories, but I switched to Mercurial soon after I found it, which was about a year ago.

Making a switch to Mercurial is easy enough, in terms of converting the Repository at least. Unfortunately I have no experience with setting up Mercurial to be web accessible in the way that libtcod (using Subversion) currently is.

I'll post a bit of information about what I'm doing talking about at the moment, as someone might find it useful, and it saves them searching for it.

Mercurial with Subversion Interoperability:
This is what I'm currently doing, and I'm using the hgsubversion plugin ( http://mercurial.selenic.com/wiki/WorkingWithSubversion#With_hgsubversion ).
I'm only using it to pull changesets (read-only access), but you can push patches as well as far as I understand. I'm not entirely sure how it interacts with TortoiseHg as the guide seems to be about command line usage only.

Converting Subversion Repository to Mercurial:
Mercurial comes bundled with a number of extensions to convert between different source control formats. The conversion process was quite easy, however I don't think I had any branches or tags in the repositories I converted as they were fairly new at the time, and most of my older repositories I had finished with and so didn't bother converting them.
There is a page outlining the process ( http://mercurial.selenic.com/wiki/WorkingWithSubversion#With_Convert_extension ), however it does look more complicated than when I last looked at it.


This post is slightly less concise than I was it would be, so if I can clarify or help with anything I'll still be lurking around here.

Pages: [1] 2 3 ... 10