I keep wondering why should I keep using monkey.
Monkey Forums/Monkey Beginners/I keep wondering why should I keep using monkey.
| ||
I have been using it for about month and a half and I ran into this issue with using pools and the animation Sequence. when I remove a sprite object and tried to fish it out of the pool it tells me array is out of bounds involving the animation Sequence??? but when I try and run it on my other computer it runs fine. Another problem is most of the targets are impossible to load correctly even when I using jungle. It's kind of frustrating when things like this happen; what if I can't get it to work the way I want it to? I wasted all this time leaning a language that only monkey uses. why was it coded this way? Why not use C, C++,C#, or java. I am seriously thinking about going back to game maker or jumping to cocos-2d-js . I had no problem coding in game maker and I accomplished as much in one week as I did in a month and a half using monkey, because of GameMakers easy programming language with readily available easy to use function plus their fantastic documentation. At the very least I was learning a language almost identical to java. could someone tell me reasons why I should stick with monkey? The only advantage I see that it has over game maker is that it is better structured for making large scaled games and its inexpensive targets which (for the most part) I can't seem to get working anyways. |
| ||
I have been using it for about month and a half and I ran into this issue with using pools and the animation Sequence. when I remove a sprite object and tried to fish it out of the pool it tells me array is out of bounds involving the animation Sequence??? Would you be willed to post a piece of code? I am sure it is possible to solve this problem. Another problem is most of the targets are impossible to load correctly even when I using jungle. Could you please clarify which targets matter the most to you so we can provide you with some help? Why not use C, C++,C#, or java. Monkey X has its roots in BASIC and thus has a slightly different syntax. The ideas are nonetheless almost identical for all the languages and once understood can be applied everywhere. I had no problem coding in game maker and I accomplished as much in one week as I did in a month and a half using monkey Would it be possible to describe your problem a little more concrete? Is there anything special you are trying to achieve where help is appreciated? |
| ||
Monkey X has its roots in BASIC And JAVA |
| ||
Doug, if I would be you and mainly develop on Windows, I would use Gamemaker. It is an awesome tool. Why did you not use it further? With the languages you have mentioned, I would choose Unity these days. Definitely! |
| ||
I had no problem coding in game maker and I accomplished as much in one week as I did in a month and a half using monkey, because of GameMakers easy programming language with readily available easy to use function plus their fantastic documentation. I'm curious, why did you try something else instead of staying with GameMaker? |
| ||
We use Monkey for cross platform desktop games and it is great. I would not use anything else. We publish commercially and have games on Steam. doug, learning to program in general terms is more useful than mastering a single language. The more you learn how to be a good programmer the better your prospects can be, and the more quickly you can pick up other languages. Don't feel time practicing new things as a waste- at a high level all concepts you grasp in one language will help you understand other languages faster. It sounds to me like you need to devote more time into learning everything programming wise, perhaps you should study some general programming books and not focus on a single language for a while. What are your goals? What do you want to be doing? If you want to get better at programming in general so that you do not have to think of how to do things but what to do, then you need to invest more time into studying programming concepts in general, as well as techniques and design patterns specific to games. If you want some book recommendations I can give you some, but you should state your goals first too. |
| ||
like I said in my post the reason I went to monkey over game maker because in game maker when I started making a larger game it became difficult to handle. It was also really hard to manage everything unless you have been using it for years. I had used it for 3 or 4 months. The problem with game maker is when I hit a spot were something was majorly wrong I had to start from the beginning because if you change one thing it effects everything; it had very poor compartmentalization. If I was making a small scale game I would have never left game maker because it is fantastic at making small to medium sized 2d games. And yes I tired Unity but the add-ons are too expensive for me plus it had a lot of unnecessary overhead because it is designed mainly for 3d capabilities. so I narrowed it down to monkey or cocos. I chose monkey over cocos for two secondary reason: house keeping- I did not want to deal with it, and the amount of targets that monkey could access at a low price. (I should have know that the low price meant that using these targets would be extremely difficult with very limited or poor documentation. if I Knew how difficult it would be to use these targets I would went with cocos because I could already communicate with my android phone a little while after installing cocos on my computer. But, the main reason I chose monkey was I thought it would eventually speed up game development, but it hasn't. it gives me unexplainable errors that I never encountered with gameMaker or even visual studios and I just got stated using this program. soap: I disagree. I have been programming along with doing electronic design for over 20 years and for a non photographic memory-type guy I found it better to stick to one medium of programming. Unless programming is all that you are interested in (which I am not. I am also an artist, and handing the different tasks of programming along with the difficult (yet less appreciated task) of the artist is too much to deal with (check out some of my work at http://comicfury.com/comicprofile.php?url=superHeroComic especially if I also need to know a bunch of different programming languages .C type languages is clearly what most programmers use so that is the only one I would really want to use under ideal circumstances which made it very difficult for me to even consider using monkey in the first place. Anyways thanks for your inputs and unless I can figure out how to make all of the targets work I think I will go to cocos or back to game maker. At least I can make a simple windows game in game maker or make a game that I can output to my android phone in cocos. |
| ||
doug, consider putting your project on bitbucket and asking people here to take a look and offer feedback on the unexplainable problems. There are many programmers here too, maybe you can collaborate with one of them to make a project with each of you focusing on your strengths. What specific problems did you have with the targets and which ones were problems for you? It sounds like getting the Android target to work is the problem? You may already do this, but if you use "site:monkey-x.com search terms" you can find many problems you can face already have solutions discussed by others here. |
| ||
Heres the code: if some one can tell me what I am doing wrong then I would be glad to here it Strict Import tile_data Import image_loader Import projectile Import actors.enemies.enemy Import actors.friends.pastghost Import actors.enemies.enemycreator Import playniax.ignitionx.engine 'LVL1_TILE_NUMBER = 31 'LVL1_TILE_POSITON: Global CHARACTER_WALK_RIGHT:Int = 0 Global CHARACTER_WALK_LEFT:Int = 1 Global CHARACTER_WALK_BACK:Int = 2 Global CHARACTER_WALK_FRONT:Int = 3 Global CHARACTER_ATTACK:INT = 4 Global CHARACTER_DIE:Int = 5 Global PATH_ENDS:Int = 9 'Global goImage_pastGhostLvl_1:Image Global lineSprite:iLayerLine Global g_linetile:iLayerLine ' Create g_linetile. 'Global go_enemyPool:iPool ' Pool for the go_enemyPool. Global spritePastGhost:CpastGhost 'initially assigned to image goImage_pastGhostLvl_1 Global g_spriteTile:iLayerSprite[GI_LVL1_TILE_NUMBER]'an array of sprite tiles. element size is from "ground_object" module. Global gameScene:Game Class MyApp Extends iApp Method OnCreate:Int() Fv_loadImages() gameScene=New Game iStart(30) Return 0 End Method End Class Class Game Extends iEngine Field playfield1:iPlayfield ' Declaration for playfield1. Field layer:iLayer Field spriteBackGround:iLayerSprite 'Field fo_text:iLayerText Method OnCreate:Int() ' The first playfield: Self.playfield1=New iPlayfield Self.playfield1.AttachLast() 'Self.playfield1.AutoCls(0,48,0) Self.playfield1.width=640 Self.playfield1.height=480 Self.layer=New iLayer Self.layer.AttachLast(Self.playfield1) Self.spriteBackGround=New iLayerSprite Self.spriteBackGround.AttachLast(Self.layer) Self.spriteBackGround.ImagePointer(goImage_BG1) Self.spriteBackGround.Position(320,240) 'screen = 640 x 480 half(center) is 320 and 240 Local j:int = 0; For Local i:Int = 0 Until GI_LVL1_TILE_NUMBER 'an array of tiles. element size is from "ground_object" module. g_spriteTile[i]=New iLayerSprite g_spriteTile[i].AttachLast(Self.layer) Select GAI_LVL1_TILE_POSITON[j] '-----a normal tile will be placed when tile state is from 1 to 4 Case 1 g_spriteTile[i].ImagePointer(goImage_normalTile) Case 2 g_spriteTile[i].ImagePointer(goImage_normalTile) Case 3 g_spriteTile[i].ImagePointer(goImage_normalTile) Case 4 g_spriteTile[i].ImagePointer(goImage_normalTile) '-----a normal tile will be placed when tile state is from 11 to 14 Case 11 g_spriteTile[i].ImagePointer(goImage_waterTile) Case 12 g_spriteTile[i].ImagePointer(goImage_waterTile) Case 13 g_spriteTile[i].ImagePointer(goImage_waterTile) Case 14 g_spriteTile[i].ImagePointer(goImage_waterTile) '-----a gate will be placed when tile state is from 21 to 24 Case 21 g_spriteTile[i].ImagePointer(goImage_mainGateTile) Case 22 g_spriteTile[i].ImagePointer(goImage_mainGateTile) Case 23 g_spriteTile[i].ImagePointer(goImage_mainGateTile) Case 24 g_spriteTile[i].ImagePointer(goImage_mainGateTile) End Select g_spriteTile[i].Position(GAI_LVL1_TILE_POSITON[j+1],GAI_LVL1_TILE_POSITON[j+2]) 'LVL1_TILE_POSITON[j],LVL1_TILE_POSITON[j+1] j += 3 End For '----------------------------------- create past ghost------------------------------ spritePastGhost=New CpastGhost(Self.layer)'create a ghost and send it the layer it is attached to so it can attach a projectile to it spritePastGhost.AttachLast(Self.layer) spritePastGhost.ImagePointer(goImage_pastGhostLvl_1) spritePastGhost.Position(200,200) '----------- create a pool of 10 go_enemyPool START ------------------------ 'this will allow you to create 10 enemies on start up and when one is destroyed or removed for the playfield it can be use 'as an new gobin. CreateEnemyPool(10,0,3)'create a number of enemies from the pool Return 0 End Method Method OnRender:Int() Return 0 End Method Method DebugRender:Int()'ff_nextTileIndex #rem DrawText(tempNumber,10,10); tempNumber +=1; Local enemy:C_enemy For Local i:Int=0 Until go_enemyPool.Length() 'step throug the go_enemyPool in the pool enemy=C_enemy(go_enemyPool.Get(i)) DrawText( enemy.ff_tileIndex + "," + enemy.ff_nextTileIndex , (GAI_LVL1_TILE_POSITON[(enemy.ff_tileIndex)*3+1])-20, (GAI_LVL1_TILE_POSITON[(enemy.ff_tileIndex)*3+2])) Next #end 'C_enemy C_enemy Return 0 End Method Method OnUpdate:Int() If KeyHit(KEY_SPACE)'fish a single enemy from the pool if one is avaliable. enemycreator module If(FishEnemyFromPool(Self.layer)=False) Print("sorry no enemy are availibe to fish out of the pool. you need to wait for an enemy to die before adding another")'**remove this and replace with appriate data or no data at all....I don't care. End if End If Return 0 End Method End Class Function Main:Int() New MyApp;Return 0; End Function trict Import main Class Cprojectile Extends iLayerSprite Field ff_rateOfSpeed:Float = 3 Field ff_tileIndex:float = 20 Field ff_startPointX:float = 200 Field ff_startPointY:float = 180 Field fi_attachPower:Int = 10 Field fb_targetOnce:Bool = True Field fo_enemyTarget:C_enemy = Null 'Field fo_trajectileState:Int = 0 Field fb_var_bool_striaght_towards_enemy:Bool = False Method OnUpdate:Int() Local enemy:C_enemy For Local i:Int=0 Until go_enemyPool.Length() 'step throug the go_enemyPool in the pool enemy=C_enemy (go_enemyPool.Get(i)) If(enemy.ff_tileIndex = Self.ff_tileIndex)And(fb_targetOnce) self.fb_targetOnce=False Self.fo_enemyTarget=enemy Self.visible = True; End if Next 'these 3 "if then" statements are used to make the projectile curve from an upward direction to a downward one. 'it make the projectile have a cool arc to it. if((self.y <= self.ff_startPointY)and(self.y > self.ff_startPointY-50)) Self.y-=10 else if((self.y <= self.ff_startPointY-50)and(self.y > self.ff_startPointY-60)) Self.y-=10;Self.x+=5 else if((self.y <= self.ff_startPointY-60)and(self.y > self.ff_startPointY-75)) Self.y-=5;Self.x+=7 'this if statement is called after the curve is finished it will cause the projectile to head striaght 'at the enemy. else if((self.y <= self.ff_startPointY-75)and(self.y > self.ff_startPointY-90)) self.fb_var_bool_striaght_towards_enemy = True; Endif If( self.fb_var_bool_striaght_towards_enemy) If(self.fo_enemyTarget)Then 'first make sure goblin has been targeted and the projectile exists. self.MoveTowards( self.fo_enemyTarget.x, self.fo_enemyTarget.y, Self.ff_rateOfSpeed ) If(self.x < self.fo_enemyTarget.x+16 And self.x > self.fo_enemyTarget.x-16) If(self.y < self.fo_enemyTarget.y+16 And self.y > self.fo_enemyTarget.y-16) Print("hit target") Self.x=Self.ff_startPointX self.y=Self.ff_startPointY self.fo_enemyTarget.fi_health -=Self.fi_attachPower self.fo_enemyTarget=Null fb_targetOnce=True; Self.visible = false; Self.fb_var_bool_striaght_towards_enemy=false End If End if End if Endif Return 0 End Method End Class Strict Import main Global go_enemyPool:iPool ' Pool for the go_enemyPool. Function CreateEnemyPool:bool(numOfEnemies:Int = 10, enemyType:Int = 0, enemySpeed:Float = 3) '----------- create a pool of 15 go_enemyPool START ------------------------ 'this will allow you to create 15 gobins on start up and when one is destroyed or removed for the playfield it can be use 'as an new gobin. go_enemyPool=New iPool(numOfEnemies) ' Maximum number of enemies of a given type on the field at one time For Local s:Int=0 Until go_enemyPool.Length() 'step throug the number of enemies in the go_enemyPool Local enemy:C_enemy = New C_enemy(enemyType,enemySpeed) ' Create a enemy object the usual way. go_enemyPool.Throwing(enemy) ' Put(throw) the enemy object in the enemy pool. Next '----------- create a pool of 15 go_enemyPool END ------------------------ Return false End Function '#rem Function FishEnemyFromPool:bool(layer:iLayer) Local enemy:C_enemy = C_enemy(go_enemyPool.Fishing())' Find the first available enemy in the pool and return it and place it into the enemy object variable If(enemy)'if a enemy is avaliable place him at the beginging of the path 'enemy.ImagePointer(goImage_enemyWalkRight) 'set the image pointer to point at the desired image enemy.ImagePointer(goImage_Gremlin) 'set the image pointer to point at the desired image enemy.Position(GAI_LVL1_PATH1_INDEX[1],GAI_LVL1_PATH1_INDEX[2])'initially position this off screen on the start of the path enemy.ScaleX=-1; enemy.AttachLast(layer) 'iLayer Return True'let program know than an ememy is avaliable End If Return False'no enemies are avaliable End function Strict 'LVL1_TILE_NUMBER = 31 'LVL1_TILE_POSITON: Import main 'Import tile_data 'Import playniax.ignitionx.engine 'first prefex letter is the variables: g = global, l= local, f = field, p = parameter ------- NON-variables: F = function M = method, C= class, I=interface, P=propeties '[Second prefex] letter is the type: i = int, f=float, b=boolean, s=string, a = array ,o=object,v = void '[third prefex] letter used with arrays it will state the array type: i = int, f=float, b=boolean, s=string, a=array , o=object '[Fourth prefex] letter used with arrays of arrays it will state the array type: i = int, f=float, b=boolean, s=string, o=object Class C_enemy Extends iLayerSprite Field fi_spriteState:Int 'this tell you which way it moving or acting and which sprite image to use. Field fi_prevSpriteState:Int=9 'this give the previous state of fi_spriteState Field ff_tileIndex:Float = 0.0 '0.0 this is the tile index of the tile the sprite is walking away from Field ff_nextTileIndex:Float = 1.0 ' 1.0 this is the tile index of the the tile the sprite is walking towards Field fb_tileChange:Bool = False 'strings showing the animation actions of the extended sprite. 'Field foImage_Actions:Image Field FAI_TILE_POSITION_ARRAY:Int[] = GAI_LVL1_TILE_POSITON'this is the land only tile path Field FAI_PATH_POSITION_ARRAY:Int[] = GAI_LVL1_PATH1_INDEX Field ff_PathNextPointX:Float Field ff_PathNextPointY:Float Field fi_PathIndex:Int = 0 Field fi_NextPathIndex:Int = 0 Field fi_PathDirection:Int = 0 Field fi_PathPrevDirection:Int = 1 Field fi_pathNextX:Int = 0 Field fi_pathNextY:Int = 0 Field fb_updateSpriteState:bool = false Field fi_PathNextDirection:Int = 0 Field fb_pathEnds:Bool = False Field ff_offsetX:Float=0 Field ff_offsetY:Float=0 '------------------attributes---------- Field fi_enemyType:Int = 0 Field fi_health:Int=30 Field fi_maxHealth:Int = 30 Field fi_strenght:Float=10 Field ff_pathSpeed:Float = 1 Field ff_pathSpeedDiag:Float = 1 * 0.7 'the sprite will move 1.414 time faster in the diagnol direction so it needs to be lowered by the reciptical value(.707). '--------------------------------------------------------------------methods---------------------------------------------------- Method New(enemyType:Int=0,speed:Float=1)'this is the constructer made when new is used ff_pathSpeed = speed ff_pathSpeedDiag= speed * 0.7 'the sprite will move 1.414 time faster in the diagnol direction so it needs to be lowered by the reciptical value(.707). fi_enemyType = enemyType End Method OnCreate:Int() Return 0 End Method OnUpdate:Int() 'iDT.TargetFPS(10) 'Self.AnimationLoop( iFPSToStep(15) )'this is a cool feature it lets me set my animation speed of the sprite 'Self.AnimationSequence( [5,4,3,2,1,0],iDT.DeltaTime(), "gremlinWalkSide_32.png" ) 'Self.AnimationSequence( [5,4,3,2,1,0],iDT.DeltaTime()) 'scaleX=-1; 'Self.AnimationSequence( [5,4,3,2,1,0],iFPSToStep(15)) 'Self.AnimationSequence( [0,1,2,3,4,5],iFPSToStep(15)) If(Self.y < 10 ) 'If(fi_health <=0) 'Self.fi_PathNextDirection = CHARACTER_DIE fi_PathIndex=0;fi_NextPathIndex=0;fi_PathDirection=0;fi_pathNextX=0;fi_pathNextY=0;fi_PathNextDirection=0;fi_PathPrevDirection=1; fi_prevSpriteState=0;ff_tileIndex=0;ff_nextTileIndex=1; fi_health=fi_maxHealth Self.Remove() Else If(fi_health <=0) Frame = 5; Self.fi_PathNextDirection = CHARACTER_DIE End if 'follow the path unless character is dieing or is attacking. If(Self.fi_PathNextDirection <> CHARACTER_DIE)and(Self.fi_PathNextDirection <> CHARACTER_ATTACK) Mb_followPath( )'have character follow path. it will return true if path has ended. End if Mv_UpdateSpriteImageState( )'this set which image animation will be played based on direction or object it can interact with Mi_findTilecharacterIsOn( )'this will find the tile that the sprite is mostly on Return 0 End '----------------------------------------------------------path following method------------------------------------------------- Method Mb_followPath:Bool() If(fi_PathIndex = fi_NextPathIndex)'check to see if pathIndex = nextpathIndex this happens when the sprite matches the same location as the nextTile 'the path direction is located at index 0 for the first then 3,6,9...etc for the 2,3,4th value etc. so to find this direction you need to multipy the index by 3 'the value at FAI_PATH_POSITION_ARRAY[fi_PathIndex*3] will be 0x,1x,2x...nx the number is the same as the index multipying it by 10. if the index is 3 the value will be 3x. 'to find the (direction x) you need to multiply the index (3) by 10 giving you 30 then subtact the array value by that value" (3x-30= x)(x=direction) fi_PathDirection = FAI_PATH_POSITION_ARRAY[fi_PathIndex*3] - 10*fi_PathIndex' fi_PathNextDirection = FAI_PATH_POSITION_ARRAY[(fi_PathIndex+1)*3] - 10*(fi_PathIndex+1)' fi_pathNextX = FAI_PATH_POSITION_ARRAY[(fi_PathIndex+1)*3+1]'each path points x value is found by mutlipling of 3 to the index plus 1 fi_pathNextY = FAI_PATH_POSITION_ARRAY[(fi_PathIndex+1)*3+2]'each path points y value is found by mutlipling of 3 to the index plus 2 Self.fi_NextPathIndex=Self.fi_PathIndex+1;'set the next path index to be the point just in front of the currently selected path point. 'Print("current path index = " + Self.fi_PathIndex + " next path index = " + Self.fi_NextPathIndex + " direction = " + fi_PathDirection) else Select Self.fi_PathDirection 'check to see which direction the sprite is currently walking towards to perform the correct calculations. Case CHARACTER_WALK_RIGHT If(Self.x >= fi_pathNextX)And(Self.x < fi_pathNextX+Self.ff_pathSpeed)'check to see if the next tile has approximately the same x value as this sprite. Self.fi_PathIndex = Self.fi_NextPathIndex;'set the current path index to the next path index up on the array list. self.fb_updateSpriteState=true Else Self.x += Self.ff_pathSpeedDiag;'the x value is decremented End If Case CHARACTER_WALK_LEFT If(Self.x <= fi_pathNextX)And(Self.x > fi_pathNextX-Self.ff_pathSpeed)'check to see if the next tile has approximately the same x value as this sprite. Self.fi_PathIndex = Self.fi_NextPathIndex;'set the current path index to the next path index up on the array list. self.fb_updateSpriteState=true Else Self.x -= Self.ff_pathSpeedDiag;'the x value is decremented End If Case CHARACTER_WALK_FRONT If(Self.y >= fi_pathNextY)And(Self.y < fi_pathNextY+Self.ff_pathSpeed)'check to see if the next tile has approximately the same y value as this sprite. Self.fi_PathIndex = Self.fi_NextPathIndex;'set the current path index to the next path index up on the array list. self.fb_updateSpriteState=true Else Self.x -= Self.ff_pathSpeedDiag;'the x value is decremented self.y += self.ff_pathSpeedDiag;'the y value is incremented End If Case CHARACTER_WALK_BACK If(Self.y <= fi_pathNextY)And(Self.y > fi_pathNextY-Self.ff_pathSpeed)'check to see if the next tile has approximately the same y value as this sprite. Self.fi_PathIndex = Self.fi_NextPathIndex;'set the current path index to the next path index up on the array list. self.fb_updateSpriteState=true Else Self.x += Self.ff_pathSpeedDiag;'the x value is decremented Self.y -= Self.ff_pathSpeedDiag;'the y value is incremented End If Case CHARACTER_DIE Case CHARACTER_ATTACK Case PATH_ENDS Return true'path has ended End Select End if Return False'path not ended...still following path End Method 'this set which image animation will be played based on direction or object it can interact with Method Mv_UpdateSpriteImageState:Void( ) If(Self.fb_updateSpriteState=True) And (Self.fi_PathNextDirection <> CHARACTER_DIE) 'chect to see if direction has changed by comparing the current sprite state with the preious one. Select self.fi_PathNextDirection 'find out which animation will be played based on the state of the sprite. Case CHARACTER_WALK_RIGHT scaleX=-1; Case CHARACTER_WALK_LEFT scaleX=1; Case CHARACTER_WALK_FRONT scaleX=1; Case CHARACTER_WALK_BACK scaleX=-1; End Select Self.fb_updateSpriteState=False ' this will prevent a new sprite from being loaded until a directional change is made. End If Select Self.fi_PathNextDirection 'find out which animation will be played based on the state of the sprite this happens continuosly Case CHARACTER_WALK_RIGHT Self.AnimationSequence( [5,4,3,2,1,0],iFPSToStep(15)) Case CHARACTER_WALK_LEFT Self.AnimationSequence( [0,1,2,3,4,5],iFPSToStep(15)) Case CHARACTER_WALK_FRONT Self.AnimationSequence( [0,1,2,3,4,5],iFPSToStep(15)) Case CHARACTER_WALK_BACK Self.AnimationSequence( [5,4,3,2,1,0],iFPSToStep(15)) Case CHARACTER_DIE Self.AnimationSequence( [5,6,7,8,9],iFPSToStep(15)) If(Self.Frame() = 9) fi_PathIndex=0;fi_NextPathIndex=0;fi_PathDirection=0;fi_pathNextX=0;fi_pathNextY=0;fi_PathNextDirection=0;fi_PathPrevDirection=1; fi_prevSpriteState=0;ff_tileIndex=0;ff_nextTileIndex=1; fi_health=fi_maxHealth Self.Remove() End If Case CHARACTER_ATTACK Self.AnimationSequence( [10,11,12],iFPSToStep(15)) End Select End Method '------------------------------------------------------------------find which tile this character is the most on---------------------------------------------------------------- 'this function tells which sprite the character is mostly standing on by checking between the x centers for left to right momements and the y centers from up down movements. Method Mi_findTilecharacterIsOn:Int( ) Select self.fi_spriteState Case CHARACTER_WALK_RIGHT If(Abs(Self.x-FAI_TILE_POSITION_ARRAY[(ff_tileIndex)*3+1]) < Abs(Self.x-FAI_TILE_POSITION_ARRAY[(ff_tileIndex+1)*3+1]))'if distance between sprite.x and the current tile is greater than the distance from the nexttile fb_tileChange = True; Else If(fb_tileChange) Self.ff_tileIndex = Self.ff_nextTileIndex Self.ff_nextTileIndex += 1.0; fb_tileChange=False endif Case CHARACTER_WALK_LEFT If(Abs(Self.x-FAI_TILE_POSITION_ARRAY[(ff_tileIndex)*3+1]) < Abs(Self.x-FAI_TILE_POSITION_ARRAY[(ff_tileIndex+1)*3+1])) If(fi_prevSpriteState <> fi_spriteState) fb_tileChange = True; fi_prevSpriteState = fi_spriteState Endif Else If(fb_tileChange) Self.ff_tileIndex = Self.ff_nextTileIndex Self.ff_nextTileIndex += 1.0; fb_tileChange=False endif Case CHARACTER_WALK_FRONT If(Abs(Self.y - FAI_TILE_POSITION_ARRAY[(ff_tileIndex)*3+2]) < Abs(Self.y - FAI_TILE_POSITION_ARRAY[(ff_tileIndex+1)*3+2])) If(fi_prevSpriteState <> fi_spriteState) fb_tileChange = True; fi_prevSpriteState = fi_spriteState Endif Else If(fb_tileChange) Self.ff_tileIndex = Self.ff_nextTileIndex Self.ff_nextTileIndex += 1.0; fb_tileChange=False endif Case CHARACTER_WALK_BACK If(Abs(Self.y - FAI_TILE_POSITION_ARRAY[(ff_tileIndex)*3+2]) < Abs(Self.y - FAI_TILE_POSITION_ARRAY[(ff_tileIndex+1)*3+2])) If(fi_prevSpriteState <> fi_spriteState) fb_tileChange = True; fi_prevSpriteState = fi_spriteState Endif Else If(fb_tileChange) Self.ff_tileIndex = Self.ff_nextTileIndex Self.ff_nextTileIndex += 1.0; fb_tileChange=False endif End Select Return Self.ff_tileIndex End Method End class Strict Import main Class CpastGhost Extends iLayerSprite Field fo_Projectile:Cprojectile = Null 'this is the projtile it will be firing Field attachedLayer:iLayer Method New(layer:iLayer) attachedLayer=layer End method Method OnUpdate:Int() If(fo_Projectile = Null) fo_Projectile=New Cprojectile fo_Projectile.AttachLast(Self.attachedLayer) fo_Projectile.ImagePointer(goImage_projectile) fo_Projectile.Position(Self.x,Self.y - 20) fo_Projectile.visible = False End if Return 0 End method End Class Global GI_LVL1_TILE_NUMBER:Int = 34 'tile state,x,y: tile state is 1-normal tile, 2-water tile, 100-trap, or 200-gate 'tiles towards the upper left are layed down first. 'each tile has three variables 'variable 1 (0x normal tile: 01-right, 02-left, 03-back, 04-front ) /(1x water tile: 11-right, 12-left, 13-back, 14-front )/(2x MainGate tile: 21-right, 22-left, 23-back, 24-front ) 'variable 2 is the x coordinate and variable 3 is the y coordinate Global GAI_LVL1_TILE_POSITON:Int[]=[01,-32,336, 01,032,336, 01,096,336, 01,160,336, 01,224,336, 01,288,336, 01,352,336, 01,416,336,'normal tiles 01,448,304, 01,480,272, 01,512,240, 01,544,208, 01,576,176, 01,608,144, 01,544,144, 01,480,144,'normal tiles 01,416,144, 01,384,176, 01,352,208, 01,320,240, 01,256,240, 01,192,240, 01,128,240, 01,064,240,'normal tiles 01,000,240, 01,032,208, 01,064,176, 01,096,144, 01,128,112, 01,160,080, 23,192,048, 01,224,016,'normal tiles and a gate tile 12,384,240, 12,448,240]'WATER TILES 'variable 1 the lsb digit is the direction of the character 0-right, 1-left, 2-back, 3-front, ' the digits in front of the lsb is the paths point number. Example ' (this is 1rst point on path 00-right, 01-left, 02-back, 03-front, 09-path ends or final point ) for point 1 (start point) ' (this is 2nd point on path 10-right, 11-left, 12-back, 13-front, 19-path ends or final point) for point 0 ' (this is 3nd point on path 20-right, 21-left, 22-back, 23-front, 29-path ends or final point) for point 2 'variable 2 is the x coordinate and variable 3 is the y coordinate 'variables 1,2, and 3 [ point 0 , point 1 , point 2 , point 3 , point 4 , point 5 , point 6 , pt7 filler ] 'total 7 points (8-1) 'index numbers [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] Global GAI_LVL1_PATH1_INDEX:Int[] =[00,-64,338, 12,416,336, 21,608,144, 33,416,144, 41,320,240, 52,000,240, 62,320,-80, 69,-999,-999] 'level 1 path 1 all land path Global GAI_LVL1_PATH2_INDEX:Int[] =[00,-64,338, 12,416,336, 21,512,240, 32,000,240, 49,320,-80, 49,-999,-999] 'level 1 path 2 land & water path Global GAS_GOBLIN_IMAGE_ACTIONS:String[] = ["goblinWalkSideRight_64.png","goblinWalkSideLeft_64.png","goblinWalkFront_64.png","goblinWalkBack_64.png","goblinDeath_64.png","goblinDig_64.png"] #rem Global G_LVL1_TILE_POSITON:Int[] =[1,224,16,200,192,48,1,160,80,1,128,112,1,96,144,1,64,176,1,32,208,1,0,240, 'old lile postion data remove later 1,64,240,1,128,240,1,192,240,1,256,240,1,320,240,1,352,208,1,384,176,1,416,144, 1,480,144,1,544,144,1,608,144,1,576,176,1,544,208,1,512,240,1,480,272,1,448,304, 1,416,336,1,352,336,1,288,336,1,224,336,1,160,336,1,96,336,1,32,336,1,-32,336, 2,384,240,2,448,240]'WATER TILES AT THE END #end Global G_LVL1_TILE_PATH1_INDEX:Int[] =[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,99999]'***old path follower remove later. 'Global LVL1_TILE_PATH1_INDEX:Int[] =[29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,0] Strict Import playniax.ignitionx.engine 'Global goImage_Goblin:Image Global goImage_BG1:Image Global goImage_normalTile:Image Global goImage_waterTile:Image Global goImage_mainGateTile:Image Global goImage_projectile:Image Global goImage_Gremlin:Image Global goImage_pastGhostLvl_1:Image Function Fv_loadImages:Void() goImage_Gremlin=iLoadSprite("actors/enemies/gremlinActions_32_32_13.png",32,32,13) goImage_pastGhostLvl_1 = iLoadSprite("actors/friends/pastGhost_LVL1_32_40_1.png",32,40,1) goImage_BG1=iLoadSprite("backgrounds/BG_1.png") goImage_normalTile=iLoadSprite("tiles/96_32_tile_light.png") goImage_waterTile=iLoadSprite("tiles/96_32_water_tile_light.png") goImage_mainGateTile=iLoadSprite("tiles/gates/gate_lvl_1_96_96_7.png",96,96,7) goImage_projectile=iLoadSprite("projectiles/rock_8_8_1.png",8,8,1) End Function |
| ||
Have you used version control before? I recommend you putting your project on https://bitbucket.org/ and taking the time to learn the basics of git. If you use their software Sourcetree it makes the process a little more user friendly. Looking at your project that way would be much better and easier for others to help than posting like you did before. |
| ||
Heres the code Garrr.... my eyes!! Use the code box forum codes!!!! |
| ||
Noticed you are using Playniax framework, I'm sure someone here has played with the iPool stuff. Also lack of media might make running the code difficult. Can you whittle down the bug to smallest piece of code possible? It is easy to get frustrated but don't give up... |
| ||
I should have know that the low price meant that using these targets would be extremely difficult with very limited or poor documentation. if I Knew how difficult it would be to use these targets The first time I installed the Pro version it took me 15 min to get an example running on my android with macosx and 25min to get it working on windows because I had to install a generic driver for androids that is not there on windows by default. So i would say it's rather easy to use these targets. Did you follow install docs? http://www.monkey-x.com/docs/html/Target%20SDKs_The%20Android%20target.html It's true that the fact that you have to install the anrdoid generic driver is not stipulated. But if you were programming native android you'd have to install that driver too for windows. http://developer.android.com/tools/extras/oem-usb.html abakobo |
| ||
Looking at your code, I can tell you are going to have similar problems in any language you decide to get into. Good luck if you decide to go back to GameMaker you are going to need it or same if you stay in Monkey. A couple of months are not enough to learn a language or learn proper coding techniques in it and it reflects in your coding. |
| ||
ow guys, maybe he's just an older guy whose programming experience is in embedded / procedural stuff. Monkey's definitely got a learning curve but everyone else here is right, the syntax shouldn't be what's holding you back. It may just feel frustrating in that way because it's different. A lot of the same stuff you deal with here though will be present in cocos2d. doug: Use the call stack from your error to find the code block where the index is going out of range. That should help you pinpoint where things are going amiss, or at least point you in the right direction. That huge code dump probably isn't going to be very useful for people on the forums to comb through.... |
| ||
Doug, As your issue seems to be ignitionX related post it over on the ignition forum and attach the code with all the assets and we will take a look for you http://forum.ignitionxlive.com/ . If you need to keep the assets private from other members send a private message in the forums or email myself or Tony. Stuart |
| ||
I also sometimes think I should be using pure Javascript/html5 instead of Monkey. I have bought a couple of books for it in the years but I never really started using it, So confused about that language. Monkey translates to it. Javascript has those html buttons and such. Java which I chose over monkey in 2011 I stopped using when the Applets security problems started and oracle messed things up I guess. One day my applets on my blog just stopped working. I had example game code on it an the example applet to show it off. I really had a great time with Java until it broke. I would still be using it if I could post working applets on blogger. I now also have no blog hosting solution for javascript/html5 games atm. Monkey in 2011 I only reasearched a short time. I though it was not good enough then. To used to Blitz3d. The graphical improvements like transparancy and rotation I did not notice then. I started programming in Monkey a few months ago and so far so good, so happy with the rotation and transparancy features now. I have not touched another language after I started in Monkey. I bought Blitzmax with Monkey-X and only viewed several examples for blitzmax. The Monkey forum got quite filled with examples and solutions and if I ask something I quickly get help so the lesser documentation is not that much of a problem. The only thing that anoys me is that compilation time is so much longer then blitz 3d/+ But maybe I should get a faster computer :) So I think that I will be using Monkey for a longer period. I am already preparing larger projects with it. Will do this when I get more experienced with the language. Monkey also has a good lite editor going for it. Jcreator for Java that I used and liked a lot did not work on windows 8. For javascript/html5 I have not found a good lite editor yet, Give Monkey a chance. And ask questions on the forum to learn about how to do things. |
| ||
If you send me the project I can take a look. Thanks! |
| ||
I'm someone who just now came from the Java game making arena. Java was a great toolset to work with and I like their rectangle intersect feature (aka collision detection), but when i discovered Monkey, I haven't looked back since. For one, I like how my games can be made without someone having to download extra software because it can convert to other languages like Javascript (a language which I also used). I also enjoy this forum. When I need help with something, I could easily get help with it vs. when I was using Java, I had to comb through a bunch of sites and didn't always get a straight answer. Thus, it might take a moment to learn Monkey, and once you learn it, you'll get faster with it. And this message is coming from me whom is a beginner, I suck at programming and I don't always know what I'm doing! But yet, I was able to pick up Monkey and make some games fairly quickly in it. Especially via asking questions. |
| ||
+1 (please apologize my syntax or grammar mistake, i am french) I have done and published several games and apps with Monkey for Web and Android and i am very satisfied with Monkey and Monkey community. Since i use Monkey i never found an app or a game wich should not be possible to make. Monkey is very easy to program but you have to learn Monkey's logic and learn it Step by Step. Fortunatelly, for beginners (not your case Doug, i see you use high level function and structured object) there is a tutorial forum. Doug, Monkey has a good community and reactive. So give a chance to Monkey and use Monkey's capability with Debug mode to find what's wrong. Good luck to you. |
| ||
I agree with Golump, it's a nice solid language, and perfect if you are multi-targeting systems that include mobile. For the OP, the problem may be that unfamiliar language + non-official framework + bugs = pain. Coding style can make the pain worse, but this is always an issue. It would be better IMO to learn Monkey without the use of frameworks (single-purpose modules are fine). |
| ||
I've been in the game industry (iOS, Android, PC, PS2, Xbox, etc) for nearly 15 years. Monkey is just FUN to develop for. No messing around with complex language constructs. But the language is still powerful/flexible enough to allow you to build whatever you like. It lets you focus on building your game, not engineering it. You can target every easily accessible platform there is with the same game. It's been tested by hundreds of other developers and has plenty of modules that you can build on. I've been doing development with C/C++, assembly, GL shaders, Swift, ObjC, Java, C#, Lua, Python etc. But Monkey makes me love coding again (well, I love Python coding too haha). |
| ||
maybe he's just an older guy whose programming experience is in embedded / procedural stuff. I'm an older guy (just turned 40 in January!), started with BASIC/Pascal/ASM - and I can code in OO easily. That's not an excuse. (I'm not saying you were creating an excuse either, ok?) Also, I don't get all the people complaining how difficult Monkey is. Seriously, install the SDKs for each platform, unzip monkey and you're good to go. Sometimes you have to do something more (depending on your config, where SDKs are installed - but nothing too complicated) Maybe I'm too old, but hard for me was having to learn memory locations where I should write pixels, which port should I have to write some bytes to have sound playing, having to allocate and de-allocate memory manually, having to optimize C or Pascal code with inline assembly to squeeze a little bit of speed or to free some memory up... And I'm sorry to say, but I think Gamemaker is BAD for programmers. If you program onlywith it, you'll be mind-locked on the language style, which isn't particularly good neither for maintenance, readability or even for flexibility in code. |
| ||
I don't get all the people complaining how difficult Monkey is That makes two of us then :) |
| ||
Three of us! You have to install the platform SDKs when using other programming tools / frameworks / languages... so it's not like Monkey is harder in that respect. Also, I've found that most SDKs are pretty straightforward to install and configure... |
| ||
I have also used Java applets to deploy browser based games on my site, at least until Oracle screwed that up and changed the security settings. I was already gung ho on Monkey-X anyways but it forced me to rewrite my Applets in Monkey-X, which is great for experience anyways. I have always been a BRL fan, from Blitz3d to BlitzMax and it definitely comes through with MonkeyX. Its the Basic Language which to me is one of the easiest to understand. Ultimately, MonkeyX is easy to understand and its great at porting to all the devices, you just have to spend some time learning it. Once you get to that point though you will be thankful for it. The forums are your most powerful friend when your learning MonkeyX! |
| ||
Well array out of bounds errors are normally caused when you run off the end of a array, most targets have the size of 0 to array length -1. Sometimes I've mixed this one up but now its common knowledge it might help sort your problem out :) |
| ||
Hi Doug, I can understand your view, though I do not agree with it. Being stuck at an ugly (mostly non-understandable) bug is frustrating. Also, as being a beginner with Monkey (though coding since 1984) I cannot even state that it is not a bug in Monkey or Ignition. Any tool or framework could be buggy, we are all humans at the end of the day, even being coders :-). What I think, that being more of an artist-guy, you should really take Game Maker instead. GM is excellent for non-coders (and also great for coders, I was selling GM officially in my country between 2005-2010, until YoYo took over). I do not agree also on that no big project can be managed in GM. :-) (big is a relative word, no GTA VI, for sure) Monkey-X is excellent, but regarding my experience with game making tools (since Simon's Basic on C64 to Unity 5), it is not for beginners. You have to have at least the basic concepts of our profession: coding. Without them, since Monkey is an advanced, OO language, you'll have millions of the above frustrating bugs. And without proper experience in coding, it is going to be close to impossible to overcome a bug like that. Even if it were in the framework you might have a workaround, but even that needs experience. So, have a beer (or any relaxation), and use a tool that was designed for your experience. Heads up! Cheers, Peter |
| ||
I have always been a BRL fan, from Blitz3d to BlitzMax and it definitely comes through with MonkeyX. Its the Basic Language which to me is one of the easiest to understand. Ultimately, MonkeyX is easy to understand and its great at porting to all the devices, you just have to spend some time learning it. Once you get to that point though you will be thankful for it. The forums are your most powerful friend when your learning MonkeyX! I'd like to second that sentiment - its taken me about 6 weeks of I'd say maybe 12 hours ish of coding on and off to achieve my goal of parsing some GPS bespoke files (from Garmin products) and displaying the paths from the 'real' world within a web browser - it took me considerably longer to crack that chestnut within B3D, but I wasn't so 'modular' with my code back then. Vote +1 for the Monkey ;) |
| ||
If Monkey isn't for you, then simply put, it isn't for you. In the same way that I find my experiments with XNA, Unity, Unreal Engine and Cocos to have been mostly baffling, confusing and frustrating, I can understand why similar issues may be taken up with Monkey (or any other Blitz languages) Find a language you're comfortable with, and stick with it. And that's the key.. Sticking with the language, and not giving up when you hit a roadblock. Find your way around the roadblock, and get that sweet satisfaction of having coded your way around a problem! I'm sticking with Monkey. The 70 games I've made, so far, are enough for me to say "Yeah, that's alright for me!!" |