Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About jokc

  • Rank
  1. oh sorry i didnt know that those sites offered community feedback. I was under the impression that those were for hosting projects so many people could work on them at the same time.
  2. Im nearing the point of my project where I would like some feedback from community members. What would be some good web sites where i could upload builds of my game so others could download them and help me out? Thanks
  3. jokc

    random 2d vector within set range

    Ok thanks alot guys everything is working great!
  4. jokc

    random 2d vector within set range

    Ok, so im trying to use this but the angle is not getting converted into a vector correctly example: x = math.cos(degrees) y = math.sin(degrees) print degrees print (x,y) heres the output: -90.0 (-0.44807361612917013, -0.89399666360055785) that vector should be (0,1) (straight up) so what do i need to change?
  5. jokc

    random 2d vector within set range

    heres what ive got so far: angle_range = 10 turret_pos = vec2d(self.rect.centerx, self.rect.centery) target_pos = vec2d(, dist = y - x dist_x = dist[0] # gets the x from the dist tuple dist_y = dist[1] # gets the y from the dist tuple radians = math.atan2(dist_y,dist_x) degrees = math.degrees(radians) degrees += (random.random() * angle_range) * random.choice([-1,1]) this converts the vector into a degree value then gives me a random degree value within the correct range but it does not convert it back into a vector (I have not figured out how to do that correctly yet)
  6. Im working on a tower defense game in python/pygame and im trying to program a tower that will pick a random direction to shoot but still shoot in the direction of its target. The towers shoot just fine using 2d vectors but i would like to add some randomness to their shots. And i just dont know how to go about doing this. One thing i thought of was to convert the vector to an angle and then add/subtract a number from that angle which i would then convert back into a vector as a direction for the tower to shoot. But i cant seem to get this working. I would appreciate any help with my method or maybe another method that would work better. I need the final vector to still be in the general direction of the starting vector and i would like to be able to control the range of the difference between the two with a variable. Thanks tons for anyone who can help me.
  7. So lets say i have 3 lists list1 list2 list3 cur_list = 1 and i have a current_list variable how would i go to a list based off of my cur_list value the two ways i can think of are list = list + cur_list and list = 'list' + str(cur_list) the first one doesnt work because it adds a list and an integer together the second one does work but i need one of the three lists in a variable not a string of which one how would go about doing this? this is in python by the way Thanks!
  8. yeah your right, i dont need it to be playable in a web browser at all. I just thought that would be the best way to get my games into the world. And then again I don't really need my games into the world either. I just want them on a browser because i would be able to show my little "resume" to people very easily. And i think that showing people your work is one of the great parts of the programming process. So i might want it kindof alot but i really dont actually need it at all.
  9. Quote:Original post by ApochPiQ If you ever encounter a situation that Python cannot handle (and this is a big "if"), then you can start worrying about what other tools to pick up. Depending on the problem you run into, you may want to go with C#, or Java, or Lua, or LISP, or whatever. Maybe you'll have to take a dip in the inky, rotted, corrosive brine that is C++ (although I hope for your sake that you don't!). I really would like to continue with python but im feeling like one of those "if"s is in the way because from what i hear i cannot run my pygame programs on a web browser. Yeah this isnt a barrier that halts the actual games that im making but it would in many ways be a big bonus if i could submit the games to websites. So Is this a big enough reason to switch to a different language? Or is there another way to work around this?
  10. Im 16 and have been programing python/pygame for about 6 months and i'm feeling very comfortable with the language. Ive made a few 2D games that are more tech demo style than balanced polished games heres a download if your interested for the most complete one ive worked on. Im seriously considering programing as a profession so i would like to do something productive but im wondering what i should start working on next. Ive thought about some options such as continuing to learn more in python (Astar or 3D perhaps) or maybe switch over to C++ (or another language) and try to get a game on a website. It would help alot if anyone would be willing to share any suggestions/links with me. Thanks tons!
  11. heres some code that shows what im trying to do using pygame: for alien in sprite.groupcollide(aliens, shots, 1, 1) Explosion(alien, 0) in addition to the explosion at the alien position i would also like to create an explosion at the shot location how would i go about doing this? Thanks!
  12. sorry but could someone please give me an example of the best way to do this, im stumped.
  13. I dont even know what an opengl surface is so im going to guess that im not using one. The game is pretty far into development and there are alot of modules/image files so here is just the stuff that should be most useful. i could pm a link to the source code zip file download if thats necessary. this is the code for the circle drawing and other things that might be useful import a bunch of stuff thats important from Values import * ######main game loop####### def main(): '''Display settings''' screen = pygame.display.set_mode((750, 600)) #Resolution of screen ((x, y)) clock = pygame.time.Clock() #opens clock for fps ##### the group all the turrets are being held in turrets = pygame.sprite.Group() # stuff goes into groups TurretSprites.Turret.groups = turrets, all # same as above turret_selected = None # nothing is selected while running: all.update() ##### Events ##### for event in pygame.event.get(): elif event.type == pygame.MOUSEBUTTONDOWN: # all the mouse events if event.button == 1: click = pygame.mouse.get_pos() # gets position of mouse when clicked ##### check if a turret was clicked ##### else: for t in turrets: if t.rect.collidepoint(click): turret_selected = t # so we can draw the tower stats down later else: # if we did not click on anykind of object turret_selected = None # deselect everything #skiping abunch of stuff ##### Update and draw everything ##### map1.draw(screen) # DO WORK SON! draws the tiled map background dirty = all.draw(screen) pygame.display.update(dirty) if turret_selected:, (0, 0, 0),, turret_selected.range, 1) # THE PROBLEM pygame.display.flip() clock.tick(50) #setting frame rate number = fps here is the turret module the only data that uses from here is the range and rect center so i dont see how this could be a problem import pygame class Turret(pygame.sprite.Sprite): def __init__(self, position): pygame.sprite.Sprite.__init__(self, self.groups) self.image = pygame.image.load("Images/Towers/Basic Gun.png").convert() # get image self.image.set_colorkey(self.image.get_at((0, 0))) # transparent self.rect = self.image.get_rect() # get it, just get it = (position) # where should i go dear slavelord self.SHOOTING_TIMER = 100 # time between shots self.shooting_timer = 0 # start at 0 so we are loaded when tower is placed self.pick_target = False # not picking a target right now self.range = 100 # range in pixels #bunch of other turret stuff that isnt related to the issue if you would like to download the whole running source code then i can post it and send you a link, just say so. it would be very appreciated! thanks so much to anyone who can help with this circle.draw problem
  14. Im drawing a range around a tower in a tower defense game and its not going good. tower_selected is True when you have clicked on a tower if tower_selected:, (0, 0, 0),, tower_selected.range, 1) the circle is being drawn every frame there are no problems with the actual drawing of the range (it shows up fine) but it is just slowing my game down by i would say about 1/2 of the normal frame rate. so is just expensive ( and how could i use it better) or is it more likely that something else is going wrong. And what is the best way to figure out? would it help to post all of the relevant code for you guys to look over? If i delete those two lines that tell it to draw then the game runs fine. also I am using some vector movement calculations and other stuff that maybe could be taking up alot of processing power, so maybe the is just pushing it over the edge. thanks for any help.
  15. Ive been working on normalizing and im finally able to get two numbers such as (-0.7345, 0.3421) now my problem is that putting those into rect.move_ip doesnt work because im guessing it wont work with any thing except whole numbers. so what should i use to update the moving rect with my velocity thats in decimal values?
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!