This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - XVicarious
16
« on: November 23, 2013, 09:12:55 pm »
My collection:
17
« on: September 06, 2013, 11:31:55 pm »
So you might recall my last project here: http://ourl.ca/18975While I like Python, performance was just too poor and I wanted to release it on more than Android and the way that I had formatted my code, I'd have to change so much for it to work on other platforms. So I restarted in Haxe, using OpenFL and HaxePunk. Right now its just a demo of moving around with the WASD keys, but will be updated often hopefully. There is an html5 version here ( http://xvicario.us/dis/). This is kinda laggy on Firefox for me. Also naming is still something I need help with. There is a link to the full game (old version) in the old thread linked at the top.
18
« on: August 01, 2013, 04:32:02 pm »
So my game is nearing completion (finally). One of my last problems is making the level selection screen fit the proper amount of level "buttons" per row on the screen depending on the screen's resolution. I didn't notice this (well at least the extent of the problem) until I got my new 2013 Nexus 7, whose screen size is much larger than the previous generation's (720p vs 1080p).
Basically I'm having trouble dynamically fitting objects on the screen based on the screen's resolution.
The current code I'm using as of now to fit items on the screen:
elif gameState == "levelSelect": if doOnce: buttons = pygame.sprite.Group() buttList = [] buttText = [] buttRect = [] numbers = 0 for lv in android.assets.list(): if lv.endswith(".level"): if (numbers > -1) and (numbers < 9): h = 64 buttList.append(LevelButton((numbers+1)*128-64,h,str(numbers + 1))) elif (numbers > 8) and (numbers < 17): h = 192 buttList.append(LevelButton((numbers-8)*128-64,h,str(numbers + 1))) buttons.add(buttList[numbers]) buttText.append(myFont.render(buttList[numbers].text,False,color)) buttRect.append(buttText[numbers].get_rect()) buttRect[numbers].center = buttList[numbers].rect.center numbers += 1 screen.fill((0,0,0)) buttons.draw(screen) numbers = 0 for button in buttText: screen.blit(button, buttRect[numbers]) numbers += 1 pygame.display.flip() doOnce = False
I'd like to point out I have the screen's native resolution stored in mynative[0][0] and mynative[0][1]
Its like I just hit a writer's sort of block while doing this.
19
« on: June 20, 2013, 04:40:43 pm »
Plus something that everyone else has overlooked, this is in the entirely wrong section, as this is not a project or an idea for a project. Just simply asking for help on something.
20
« on: June 09, 2013, 10:52:18 am »
It is a jpeg right now. There is a file called android-presplash.jpg and I just recycled that so I'll have to fix that. The walls are supposed to be purple and the level image green squares is actually a screenshot from the original game. Those will be fixed soon as well.
21
« on: June 08, 2013, 11:43:48 pm »
First post updated with screenshots! 1: The menu screen 2: The first level 3: The first level with the dpad moved! 4: The second level
22
« on: June 08, 2013, 11:54:45 am »
DJ: It should run on your phone, as API8 is Android 2.2. But the problem lies within the screen size right now. I'm not entirely sure what is wrong. I'll have to fire up an emulator with a small screen size to test this out.
Streetwalker: Its a bit optimized and Python, being an interpreted language running on a phone. But it can run about 200fps on my desktop (although pretty powerful), so I think there is some optimization that can be done. Although I haven't really tried it on my phone since some of the optimization so I don't know exactly.
aeTIos: I know this, and I honestly have no clue at why this is. I haven't tried to fix it yet, since it only happens every once and a while and I wanted to concentrate on the rest of the engine first.
23
« on: June 08, 2013, 12:27:54 am »
Oh boy Juju, I didn't plan for such small screens. That will be something I'll have to fix. The black screen and crash might have something to do with that, so again I'll have to fix that. DJ: I think so. I'm pretty sure that the minimum API level is 8 which is Android 2.3. My screen resolution is at least 1280x720 so if it is less than that I'll have to make sure to fix that.
Also new version is up with the splash screen (dunno if that was in there before), and a menu with "Play" and "Quit" working, "Levels" does not work yet.
24
« on: June 07, 2013, 06:47:20 pm »
Well its all "elif" for the controls. You might be accientally pressing one of the inter-cardinal directions instead. Good idea for the floating joystick. I'll likely get that done when I finish the rest of the engine (I only have a little more to go, the menu screen, saving the levels you completed, and level selection). Possibly for the floating dpad I can have you hold the middle button on the dpad to move it. It it quite hard. But all the levels are possible amazingly. There is a level (or two) that uses a dirty trick in the original you have to use and a new element from the 2nd game (which will be incorporated in this one) in a few levels. At least the levels that use dirty tricks will be slightly revised, I haven't decided yet on the "bombs" from the second yet.
I'm starting to think to just use the original name "Danger in Shapes".
EDIT: I did the floating DPad. It works, but might be a tad of a pain to use.
25
« on: June 07, 2013, 02:39:04 pm »
Post updated. Please I need some help naming this game.
26
« on: June 06, 2013, 11:28:23 pm »
This really isn't an open source game. I trust you guys, and I know it is a public topic but I doubt many will see it.
And thank you very much for the help. As I've said in the project topic, Omnimaga members get a free copy.
27
« on: May 29, 2013, 03:16:55 pm »
Now something strange is happening: Level 1: Level 2: 01.level (the data for placing enemies, the endpoint and the player) is being loaded for level 2 as well. Code is below. (also notice all the extra things, for some reason they aren't being cleared...) they should have been since the screen is cleared when the level loads, and a new TileMapper object is used to handle the level data. I'm pretty sure the problems lie within LoadLevel.py main.py or Screen.py My game runs at a near steady 30fps on my Nexus 7, but struggles on my Galaxy Nexus. The problem is the GNex is a fairly powerful phone and it is struggling with this. I don't know what exactly is making it run so slowly. I know that it shouldn't be as slow as it is. I know, Python and Mobile device, but honestly I don't think it should be running as slowly as it is. My code is as follows: main.py import pygame, math try: import android except ImportError: android = None # Import our objects from Player import Player from Enemy import Enemy from EndPortal import EndPortal from Control import Controller from LoadLevel import Level, TileMapper, LoadLevel from Screen import GameScreen
clock = pygame.time.Clock()
def main(): pygame.init() print "start game!" if android: android.init() android.map_key(android.KEYCODE_BACK, pygame.K_ESCAPE) mynative = pygame.display.list_modes() s_res = (mynative[0][0],mynative[0][1]) screen = pygame.display.set_mode(s_res,pygame.FULLSCREEN) # Level Surface currentLevel = 0 gameState = "levelLoad" scroll_x = 0 scroll_y = 0 if android: s = android.assets.open("bg.png") else: s = "../assets/bg.png" stars = pygame.image.load(s).convert() if android: # Setup Onscreen Controller controllerList = pygame.sprite.Group() middle = Controller(96,mynative[0][1]-192,"none") controllerList.add(middle) upArrow = Controller(96,mynative[0][1]-288,"up") controllerList.add(upArrow) downArrow = Controller(96,mynative[0][1]-96,"down") controllerList.add(downArrow) leftArrow = Controller(0,mynative[0][1]-192,"left") controllerList.add(leftArrow) rightArrow = Controller(192,mynative[0][1]-192,"right") controllerList.add(rightArrow) upleftArrow = Controller(0,mynative[0][1]-288,"upleft") controllerList.add(upleftArrow) uprightArrow = Controller(192,mynative[0][1]-288,"upright") controllerList.add(uprightArrow) downleftArrow = Controller(0,mynative[0][1]-96,"downleft") controllerList.add(downleftArrow) downrightArrow = Controller(192,mynative[0][1]-96,"downright") controllerList.add(downrightArrow) done = True if android: pygame.event.set_allowed([pygame.QUIT, pygame.KEYDOWN, pygame.MOUSEMOTION, pygame.MOUSEBUTTONUP]) else: pygame.event.set_allowed([pygame.QUIT, pygame.KEYDOWN, pygame.KEYUP]) tickClock = 0
while done == True: if tickClock == 30: print math.floor(clock.get_fps()) tickClock = 0 tickClock += 1 if gameState == "levelLoad": currentLevel += 1 if (currentLevel.__str__().zfill(2)+".png") in android.assets.list(): screen.fill((255,255,255)) level = None newLevel = None tMap = None player = None endPortal = None level = pygame.Surface((640,416)) level.fill((255,255,255)) newLevel = LoadLevel(currentLevel.__str__().zfill(2)+".level") tMap = TileMapper(newLevel) level.blit(stars,(0,0)) myLevel = Level(currentLevel.__str__().zfill(2)+".png") level.blit(myLevel.image,(0,0)) player = tMap.player endPortal = tMap.endPortal gameLevel = GameScreen(level) dirties = [] for e in tMap.enemyList: dirties.append(e.rect) gameLevel.drawScreen(screen,tMap,scroll_x,scroll_y) pygame.display.flip() gameState = "level" else: done = False # Track event happening for event in pygame.event.get(): if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: print "Quitting..." done = False if android: # Movement if event.type == pygame.MOUSEMOTION: mouse_pos = pygame.mouse.get_pos() if upArrow.rect.collidepoint(mouse_pos): player.change_x = 0 player.change_y = -3 elif downArrow.rect.collidepoint(mouse_pos): player.change_x = 0 player.change_y = 3 elif leftArrow.rect.collidepoint(mouse_pos): player.change_x = -3 player.change_y = 0 elif rightArrow.rect.collidepoint(mouse_pos): player.change_x = 3 player.change_y = 0 elif upleftArrow.rect.collidepoint(mouse_pos): player.change_x = -3 player.change_y = -3 elif uprightArrow.rect.collidepoint(mouse_pos): player.change_x = 3 player.change_y = -3 elif downleftArrow.rect.collidepoint(mouse_pos): player.change_x = -3 player.change_y = 3 elif downrightArrow.rect.collidepoint(mouse_pos): player.change_x = 3 player.change_y = 3 else: player.change_x = 0 player.change_y = 0 elif event.type == pygame.MOUSEBUTTONUP: player.change_x = 0 player.change_y = 0 else: if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: player.changeSpeed(-3,0) if event.key == pygame.K_RIGHT: player.changeSpeed(3,0) if event.key == pygame.K_UP: player.changeSpeed(0,-3) if event.key == pygame.K_DOWN: player.changeSpeed(0,3) if event.type == pygame.KEYUP: if event.key == pygame.K_LEFT: player.changeSpeed(3,0) if event.key == pygame.K_RIGHT: player.changeSpeed(-3,0) if event.key == pygame.K_UP: player.changeSpeed(0,3) if event.key == pygame.K_DOWN: player.changeSpeed(0,-3) # Perform Updates if player.change_x or player.change_y: player.update(myLevel,tMap.enemyList) dirties.append(player.rect) for enemy in tMap.enemyList: enemy.update(myLevel) if endPortal.update(player): gameState = "levelLoad" # Check if Android version is not focused, if so pause the game if android: if android.check_pause(): android.wait_for_resume() # Draw gameLevel.drawScreen(screen,tMap,scroll_x,scroll_y) if android: controllerList.draw(screen) # Game Camera # Buggy, always starts on top, but works. if (player.rect.y >= 208): if (gameLevel.scroll_y_limit >= 3) and player.change_y > 0: scroll_y += 3 elif (player.rect.y <= 208): if (scroll_y > 0) and player.change_y < 0: scroll_y -= 3
pygame.display.update(dirties) clock.tick(30)
# This isn't run on Android. if __name__ == "__main__": main()
Player.py ''' Created on May 20, 2013
@author: XVicarious '''
import pygame
try: import android except ImportError: android = None class Player(pygame.sprite.DirtySprite): change_x = 0 change_y = 0 origin_x = 0 origin_y = 0 def __init__(self,x,y,scale = 1): pygame.sprite.DirtySprite.__init__(self) if android: sprite = android.assets.open("player.png") else: sprite = "../assets/player.png" self.image = pygame.image.load(sprite).convert_alpha() self.image = pygame.transform.scale(self.image,(self.image.get_width()*scale,self.image.get_height()*scale)) self.rect = self.image.get_rect() self.rect.x = x self.origin_x = x self.rect.y = y self.origin_y = y self.mask = pygame.mask.from_surface(self.image) def changeSpeed(self,x,y): self.change_x += x self.change_y += y def update(self,wall,enemies): old_x = self.rect.x old_y = self.rect.y self.rect.x += self.change_x self.rect.y += self.change_y if pygame.sprite.collide_mask(self,wall): self.rect.x = old_x self.rect.y = old_y for anEnemy in enemies: if pygame.sprite.collide_mask(self,anEnemy): self.death() def death(self): self.rect.x = self.origin_x self.rect.y = self.origin_y
Wall.py (currently unused, using test level format) ''' Created on May 21, 2013
@author: XVicarious '''
import pygame
try: import android except ImportError: android = None
class Wall(pygame.sprite.Sprite):
def __init__(self,x,y,scale,t = 0): pygame.sprite.Sprite.__init__(self) if t == 0: if android: sprite = android.assets.open("wall.png") else: sprite = "../assets/wall.png" elif t == 1: if android: sprite = android.assets.open("ubridge.png") else: sprite = "../assets/ubridge.png" elif t == 2: if android: sprite = android.assets.open("ubridge2.png") else: sprite = "../assets/ubridge2.png" self.image = pygame.image.load(sprite).convert_alpha() self.image = pygame.transform.scale(self.image,(self.image.get_width()*scale,self.image.get_height()*scale)) self.rect = self.image.get_rect() self.rect.x = x self.rect.y = y self.mask = pygame.mask.from_surface(self.image)
Enemy.py import pygame try: import android except ImportError: android = None class Enemy(pygame.sprite.DirtySprite): change_x = 0 change_y = 0 enemy_type = 0 def __init__(self,x,y,etype,scale): pygame.sprite.DirtySprite.__init__(self) if etype == 0: if android: sprite = android.assets.open("enemy_horz.png") else: sprite = "../assets/enemy_horz.png" elif etype == 1: if android: sprite = android.assets.open("fastenemy_horz.png") else: sprite = "../assets/fastenemy_horz.png" elif etype == 2: if android: sprite = android.assets.open("enemy_vert.png") else: sprite = "../assets/enemy_vert.png" elif etype == 3: if android: sprite = android.assets.open("fastenemy_vert.png") else: sprite = "../assets/fastenemy_vert.png" self.image = pygame.image.load(sprite).convert_alpha() self.image = pygame.transform.scale(self.image,(self.image.get_width()*scale,self.image.get_height()*scale)) self.rect = self.image.get_rect() self.rect.x = x + 3 self.rect.y = y + 3 self.mask = pygame.mask.from_surface(self.image) self.enemy_type = etype if self.enemy_type == 0: self.change_x = -6 elif self.enemy_type == 1: self.change_x = -12 elif self.enemy_type == 2: self.change_y = -6 elif self.enemy_type == 3: self.change_y = -12 def update(self,wall): self.rect.x += self.change_x self.rect.y += self.change_y if pygame.sprite.collide_mask(self, wall): self.change_x *= -1 self.change_y *= -1 self.rect.x += self.change_x self.rect.y += self.change_y self.dirty = 1
LoadLevel.py ''' Created on May 23, 2013
@author: XVicarious ''' import base64, pygame from Wall import Wall from Player import Player from EndPortal import EndPortal from Enemy import Enemy try: import android except ImportError: android = None class LoadLevel(object): levelList = [] def __init__(self, levelNumber): print levelNumber if android: level64 = android.assets.open(levelNumber) else: level = "../assets/" + levelNumber level64 = open(level,'r') levelString = base64.standard_b64decode(level64.read()) for line in levelString: for char in line: if char == '\r' or char == '\n': foo = "bar" else: self.levelList.append(char) class TileMapper(object):
enemyList = pygame.sprite.Group() extraList = pygame.sprite.Group() player = None endPortal = None def __init__(self,levelList,scale = 1): for i in range(0,13): for j in range(0,20): # 2 -- player # 3 -- Vertical Enemy # 4 -- Horizontal Enemy # 5 -- Fast Vertical Enemy # 6 -- Fast Horizontal Enemy if levelList.levelList[(i*20)+j] == '2': self.player = Player(j*32,i*32,scale) self.extraList.add(self.player) print "Player", j*32, i*32 elif levelList.levelList[(i*20)+j] == '3': self.enemyList.add(Enemy(j*32,i*32,2,scale)) elif levelList.levelList[(i*20)+j] == '4': self.enemyList.add(Enemy(j*32,i*32,0,scale)) elif levelList.levelList[(i*20)+j] == '5': self.enemyList.add(Enemy(j*32,i*32,3,scale)) elif levelList.levelList[(i*20)+j] == '6': self.enemyList.add(Enemy(j*32,i*32,1,scale)) elif levelList.levelList[(i*20)+j] == '9': self.endPortal = EndPortal(j*32,i*32) self.extraList.add(self.endPortal)
class Level(pygame.sprite.Sprite): def __init__(self,image,levelData = None): pygame.sprite.Sprite.__init__(self) if android: sprite = android.assets.open(image) else: sprite = "../assets/" + image self.image = pygame.image.load(sprite).convert_alpha() self.rect = self.image.get_rect() self.mask = pygame.mask.from_surface(self.image)
Screen.py ''' Created on Jun 3, 2013
@author: xvicarious '''
import pygame
class GameScreen(object): mynative = None drawnScreen = None levelSurf = None newHeight = None scroll_y_limit = None
def __init__(self, levelSurface): self.mynative = pygame.display.list_modes() self.newHeight = (416*self.mynative[0][0])/640 self.levelSurf = levelSurface self.drawnScreen = levelSurface.copy() def drawScreen(self,screen,map,scroll_x,scroll_y): self.drawnScreen.blit(self.levelSurf,(0,0)) map.enemyList.draw(self.drawnScreen) map.extraList.draw(self.drawnScreen) levelScaled = pygame.transform.scale(self.drawnScreen,(self.mynative[0][0],(416*self.mynative[0][0])/640)) self.scroll_y_limit = self.newHeight - (self.mynative[0][1] + scroll_y) subSurfLevel = levelScaled.subsurface((scroll_x, scroll_y, self.mynative[0][0], self.mynative[0][1])) screen.blit(subSurfLevel,(0,0))
Note that this is my first project in Python with classes etc.
28
« on: May 25, 2013, 12:48:37 am »
You might be able to get more. My i5 (3570K) goes up to like 4.2Ghz or something.
29
« on: May 23, 2013, 03:47:35 pm »
So I have been porting an old game of mine to Android. The original name was "[Danger in Shapes]", but now honestly after five years sounds really silly. So as of now the game is unnamed. The original one is here: http://sandbox.yoyogames.com/games/68880-danger-in-shapesIf you want to play and help me think of a new name. This game is written in Python and Pygame using Pygame Subset for Android to build for Android. All you need to play is to install the APK, no extra things. I need a new name for the game. The first two levels are playable. You'll initially come to a splash screen with my logo, just tap the screen and you go to the game. Use the 8-directional DPad to move around. The levels are quite difficult, but possible. I'm currently working on the other levels. There will eventually be 30 total levels and about $1.29 on the Google Play store. http://xvicario.us/DiSAndroid-0.6-release.apkThe required version of Android is 4.0 I think (or 2.2, I really don't know lol). If need be I will see if I can build it for Android 2.2+ I know the screen resolution of the D-Pad works perfectly on my Galaxy Nexus, and my Nexus 7. If it doesn't for you if you could kindly post your screen dimensions or DPI and I can see if I can fix it. Remember this isn't a game yet. Its pretty boring, but exciting since it is my first Android app. It will be $1.29 in the Play Store I think, but I will release a special Omnimaga edition for free. EDIT: I was thinking about the levels making a list encoded in Base64, loaded from text files and read out each character representing a tile, and writing a tilemapper to draw it out. Dunno, what do you guys think? EDIT 2: 01: 11111111111111111111 12000000131111111111 11111110000011110001 19001111101011110101 11101111101000000101 10101000101111111101 13101010101100011101 10100010100400000001 11111110101011111111 10040010101011111111 11111110101011111111 10000000040000011111 11111111111111111111
30
« on: January 27, 2013, 10:09:50 pm »
There was this one program I had to make stop motion animations. The name of it completely slipped my mind. It was free and for Windows.
|