Quote: "is this the compleate Initiate_Player_Udt: sub routine?
looks odd. the type is read from compiler and the globals to,
there is nothing to jump in?
you should only jump where you set the Player_Prop.xy=
this can also be done in a function because udt var is global.
Function Init()
Player_Prop.ATT=123
EndFunction"
No this is the complete player init.
//=============================================================================
//### SECTION - PLAYER SETUP - ONLY USED ON BOOT IN MAIN.AGC
//-----------------------------------------------------------------------------
Initiate_Player_Udt:
//=============================================================================
//### SECTION - RPG Properties type
//-----------------------------------------------------------------------------
type sProp
//Standard properties, calculated from inventory
ATT As Integer //Attack
DEF As Integer //Defense
STA As Integer //Stamina
SPD As Integer //Speed
MAG As Integer //Magic (Mana recovery rate and resistance)
HEA As Integer //Health (HP recovery rate)
FEA As Integer //Fear factor
//Stat - starting stats
ATT_STAT As Integer //Attack
DEF_STAT As Integer //Defense
STA_STAT As Integer //Stamina
SPD_STAT As Integer //Speed
MAG_STAT As Integer //Magic
HEA_STAT As Integer //Health
//Effect, -1 per second
BUR_EFF As Integer //Burn effect
SHO_EFF As Integer //Shock effect
FRE_EFF As Integer //Freeze effect
POI_EFF As Integer //Poison effect
endtype
//=============================================================================
//### SECTION - RPG Properties type
//-----------------------------------------------------------------------------
type sPlayer
AttackTimer As Float
AttackSpeed As Float
AttackSound As Integer
PickupSound As Integer
WalkSound As Integer
DestroySound As Integer
DoorSound As Integer
DoorSoundFail As Integer
CandleLitSound As Integer
CandlePickSound As Integer
MapSound As Integer
InventorySound As Integer
DamageSound As Integer
CoinSound As Integer
CloseToLight As float
LightPower As float
TargetLight As float
BonusLight As float
Candle As float
CandleAmount As integer
CandleLife As float
Health As integer
Health_Max As integer
Mana As integer
Mana_Max As integer
XP As integer
XP_Max As integer
Level As integer
Money As integer
Points As integer
Food As float
Drink As float
endtype
Global Player_Prop As sProp
Global Player As sPlayer
Return
//=============================================================================
//### SECTION - PLAYER SETUP - USED EVERY TIME A DUNGEON IS CREATED
//-----------------------------------------------------------------------------
Function Setup_Player()
Player_Exits_Dungeon = 0
Global Player_Text$ As String
Global savedx# , savedy# , savedz# , moveSpeed# , turnSpeed# As Float
Global Player_Exits_Dungeon , Player_ExitX , Player_ExitY , CameraCollider , snd_book_close , snd_book_turn as integer
Global Old_Held_Item , FS_Effect_Sprite , FS_Effect_Image , FS_YouDead As Integer
Global Player_Stats_Spr_Back , Player_Stats_Image , Player_Dead_Image , Player_Stats_Img_Back , Player_Stats_Img_Close_Idle As Integer
Global Player_Stats_Img_Close_Down , Player_Stats_Img_Spend_None , Player_Stats_Img_Spend_Idle , Player_Stats_Img_Spend_Down As Integer
Global Player_Stats_Spr_Close , Player_Stats_Spr_Spend , Player_Stats_Spr_Back , GameTime As Integer
//=============================================================================
//### SECTION - DEFAULT SETTINGS
//-----------------------------------------------------------------------------
Player.Health=20
Player.Health_Max=50
Player.Mana=20
Player.Mana_Max=50
Player.XP=0
Player.XP_Max=1000
Player.Points=5
Player.Money=100
Player.AttackSpeed = 2.5
moveSpeed#=120.0
turnSpeed#=100.0
//=============================================================================
//### SECTION - PLAYER ARRAYS
//-----------------------------------------------------------------------------
global Dim Player_Spe[10] as integer
global Dim Feet_Sounds[4] as integer
Global Dim Item_Sounds[32] as integer
//=============================================================================
//### SECTION - CAMERA AND COLLIDER SETUP
//-----------------------------------------------------------------------------
SetCameraPosition(1,64+10,0,64+10)
SetCameraRotation(1,0,0,0)
SetCameraRange( 1, 1, 256 )
REM //- Default is 45 -//
SetCameraFOV( 1, 52 )
CameraCollider = SK_OBJECT__FREE_ID_()
CreateObjectCylinder(CameraCollider,200,40,6)
SetObjectVisible(CameraCollider,0)
//=============================================================================
//### SECTION - WALKING SOUND FX
//-----------------------------------------------------------------------------
Feet_Sounds[0] = SK_SOUND__LOAD_( "wav/feetsteeps.wav" )
Feet_Sounds[1] = SK_SOUND__LOAD_( "wav/feetsteeps_wood.wav" )
Feet_Sounds[2] = SK_SOUND__LOAD_( "wav/feetsteeps_stone.wav" )
Feet_Sounds[3] = SK_SOUND__LOAD_( "wav/feetsteeps_snow.wav" )
Feet_Sounds[4] = SK_SOUND__LOAD_( "wav/feetsteeps_gravel.wav" )
//=============================================================================
//### SECTION - ITEM USAGE SOUND FX
//-----------------------------------------------------------------------------
Load_wav$ as string
for s=0 to 31
Load_wav$="sound/ITEMS/PALETTE/"+str(s)+".wav"
if getfileexists(Load_wav$)=1
Item_Sounds[s]=SK_SOUND__LOAD_( Load_wav$ )
else
exit
endif
next s
Load_wav$=""
//=============================================================================
//### SECTION - PLAYER INTERACT SOUND FX
//-----------------------------------------------------------------------------
Player.PickupSound = SK_SOUND__LOAD_( "wav/Pickup.wav" )
Player.WalkSound = Feet_Sounds[0]
Player.DestroySound = SK_SOUND__LOAD_( "wav/Break.wav" )
Player.DoorSound = SK_SOUND__LOAD_( "wav/door.wav" )
Player.DoorSoundFail = SK_SOUND__LOAD_( "wav/BrokenDoor.wav" )
Player.CandleLitSound = SK_SOUND__LOAD_( "wav/candlelit.wav" )
Player.CandlePickSound = SK_SOUND__LOAD_( "wav/candlepick.wav" )
Player.MapSound = SK_SOUND__LOAD_( "wav/map.wav" )
Player.InventorySound = SK_SOUND__LOAD_( "wav/inv.wav" )
Player.DamageSound = SK_SOUND__LOAD_( "wav/player_damage.wav" )
Player.CoinSound = SK_SOUND__LOAD_( "wav/coins.wav" )
snd_book_close = SK_SOUND__LOAD_( "wav/CloseBook.wav" )
snd_book_turn = SK_SOUND__LOAD_( "wav/TurnPage.wav" )
//=============================================================================
//### SECTION - MISC IMAGE AND SPRITE CREATION
//-----------------------------------------------------------------------------
Player_Stats_Image = SK_IMAGE__LOAD_( "png/menue/player_stats_back.png" )
SK_IMAGE__FILTER_WRAP_(Player_Stats_Image,0,0)
Player_Dead_Image = SK_IMAGE__LOAD_( "png/menue/you_died.png" )
SK_IMAGE__FILTER_WRAP_(Player_Dead_Image,0,0)
if FS_Effect_Sprite = 0
FS_Effect_Sprite = createsprite(0)
setspriteposition ( FS_Effect_Sprite , GetScreenBoundsLeft() , GetScreenBoundsTop() )
setspritedepth ( FS_Effect_Sprite , 100 )
setspritetransparency ( FS_Effect_Sprite , 0 )
FixSpriteToScreen ( FS_Effect_Sprite , 1 )
endif
Player_Stats_Img_Back = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "back" )
Player_Stats_Img_Close_Idle = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "close_idle" )
Player_Stats_Img_Close_Down = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "close_down" )
Player_Stats_Img_Spend_None = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "spend_none" )
Player_Stats_Img_Spend_Idle = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "spend_idle" )
Player_Stats_Img_Spend_Down = SK_SUBIMAGE__SWITCH_( 0 , Player_Stats_Image , "spend_down" )
spr=CreateSprite(Player_Stats_Img_Close_Idle)
SetSpriteDepth(spr,1)
SetSpritePosition(spr,97+381,2000+13)
Player_Stats_Spr_Close = spr
spr=CreateSprite(Player_Stats_Img_Spend_Idle)
SetSpriteDepth(spr,1)
SetSpritePosition(spr,97+315,2000+402)
Player_Stats_Spr_Spend = spr
spr=CreateSprite(Player_Stats_Img_Back)
SetSpriteDepth(spr,2)
SetSpritePosition(spr,97,2000)
Player_Stats_Spr_Back = spr
setspritevisible(FS_Effect_Sprite,0)
setspritevisible(Player_Stats_Spr_Back,0)
setspritevisible(Player_Stats_Spr_Close,0)
setspritevisible(Player_Stats_Spr_Spend,0)
endfunction
Our problem is that we have a really huge project with huge amounts of code.
And some parts seam to not work as they should in functions or gosubs.
We initiated this before everytime a new level or shop level whas created that caused painfull crashes.
We nead to setup many player values before we create dungeons and enemys as they are placed,textured etc depending on texture variations and scripts in these files.
We have so much media during gameplay that change that we don't want to keep in memory between levels.
Its hard to explain when you don't see the mass amount of code it have
The last changes have stopped all crashes so far
And as an side note so cant we create all udts in the main file as it would get extremely large and hard to follow or debug.
You should keep in mind that this is only the player and we then have.
gui
map
enemy
items
particles
shop
inventory
and the list goes on
Edited............
Van and I created a simple solution for working on this at the same time even if we don't have so much time to do so.
We split as much as possible in to separate files so we can work on it and don't mess it up for each other to much.
he simply writes iam working in screen_shop.agc and then I don't touch that file until he is done and simply copies it in to my projects and the same for him
Android 2.3 , ZTE Skate , 480x800 , 800 mhz , Samsung Galaxy Y , 240x320 , 832 mhz , Sony ericson arc 480x854 , 1 ghz
Android 4.0 , Dmtech 3g 9738B , 1024x768 , 9.7 inches , 1.2 ghz