Jump to content

  • Log In with Google      Sign In   
  • Create Account

MrPhoenix

Member Since 18 Jan 2013
Offline Last Active Feb 19 2013 10:24 PM
-----

Topics I've Started

AS3 Error

01 February 2013 - 09:03 PM

im trying to get 2 movieclips to put there self above eachother when the other reachs the bottom of the stage

but it does not meet line to line, the stage width is 480 and height 800

and it gets faster and faster

import flash.events.Event;

stop();

function repeatBackground():void {
	
	if(gameBackground01.y + gameBackgroundY > 799) {
		gameBackground01.y = -800;
	}
	if(gameBackground02.y + gameBackgroundY > 799) {
		gameBackground02.y = -800;
	}
	if(gameBackgroundY > 799) {
		gameBackgroundY = 0;
	}
	
	gameBackgroundY++;
}

function gameLoop(e:Event):void {
	if(gamePause == 0) {
		repeatBackground();
		gameBackground01.y += gameBackgroundY;
		gameBackground02.y += gameBackgroundY;
	} else {
		
	}
}

gameBackground01.x = 0;
gameBackground01.y = -800;
gameBackground02.x = 0;
gameBackground02.y = 0;

addEventListener(Event.ENTER_FRAME, gameLoop);

 

 


Sprite Expert ?

24 January 2013 - 09:48 AM

im in the middle of making a game called (Dark Galaxy) and the story line based around a mage who ends 

up on a unknown planet with no idea how he got there or why he there

 

example of current player

259eiwn.png

 

each player needs to be 32x32 entire size of the file is 96x128

 

it would be nice if there was one with white mage robe with the hood on and one without the hood

i will give credits for the person who makes the sprite 

 

NOTE : please provide the source file for which ever program you use to make the sprite and if you can a clear background would be best


SDL Player movement & animation glitch

24 January 2013 - 09:19 AM

This is a video of the bug ill explain and post code below

 

 

when you just press down the player moves down with the animation 

if you press a another direction key with down it will take it direction sprite and move down

 

heres the code

 

        if(in_game_state == 1 && app_state == 5) {
                keystate = SDL_GetKeyState(NULL);
                if(keystate[SDLK_DOWN]) {
                    if(btnPressed == 1) {
                        if(player_pos == 2) {
                            player_pos = 1;
                        }else if(player_pos == 1) {
                            player_pos = 3;
                        }else if(player_pos == 3){
                            player_pos = 2;
                        }
                    }else{
                        player_pos = 2;
                    }
                    move_y -= 1;
                    btnPressed = 1;
                }else if(keystate[SDLK_UP])   {
                    player_pos = 11;
                    move_y += 1;
                    btnPressed = 1;
                }else if(keystate[SDLK_RIGHT]) {
                    player_pos = 8;
                    move_x -= 1;
                    btnPressed = 1;
                }else if(keystate[SDLK_LEFT]) {
                    player_pos = 5;
                    move_x += 1;
                    btnPressed = 1;
                }else{
                    btnPressed = 0;
                }


        }

 

Defining variables 

 

in_game_state -  is just that it that the player is on the map and is allowed to move

app_state - is just so we know we are on the map part of the game

btnPressed - is just if the button pressed or not

move_x - is the players position on the screen

move_y - is the players position on the screen

player_pos = is the position of the sprite being used ( this is how im doing the animation ) 


Python 3.3 Need help with a file

22 January 2013 - 01:09 PM

This is the file called convert.py
import json, string, re

json_data=open('Route 100.json')

data = json.load(json_data)
data_01 = data['layers']

map_name = data_01[0]['name']
map_width = data_01[0]['width'] * 32;
map_height = data_01[0]['height'] * 32;
map_data = data_01[0]['data']

print("Map Name   : ", map_name)
print("Map Width  : ", map_width)
print("Map Height : ", map_height)
print("Map Output -")
print(map_data)
print("Converted Output")

new_map_data = map_data

def replace_all(text, dic):
    for i, j in dic.iteritems():
        text = text.replace(i,j)
    return text

reps = {'[':'', ' ':'', ']':''}

output = replace_all(new_map_data, reps)


print(output)



json_data.close()

input("\n\nPress any button to exit")

 

 

and i need to replace the [ and ] and blank spaces in new_map_data or map_data

im really new to python so if you could fix this for me it would mean a lot biggrin.png ill attach the file i was using

 

 

NOTE i had to rename 'Route 100.json' to 'Route 100.txt' since gamedev dont allow json file uploads

 


Tile sheet spriting math ?

21 January 2013 - 04:46 PM

ok i got a tilesheet of 1600x1600 in size and each tile is 32px x 32px

 

i want to assign the tile like 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,etc

but im confused on the math on how to convert the tile number to the sprite_x_start and sprite_y_start

 

 

    void draw_tile(int tile_num, int x, int y, SDL_Surface *output_surface) {
        

        draw_sprite(sprite_sheet, output_surface, draw_x_spot, draw_y_spot ,sprite_x_start, sprite_y_start ,32,32);

    }

PARTNERS