New to Fuse4-want a Faery Tale Adventure like game
-
@pianofire this really helped me identify the function loosing memory . Thank you
-
@Martin thank you but I did not find and code that used the load audio routine
-
@pianofire this is the function I made that is loosing memory .
loop
clear()
DrawMap()
centreSpriteCamera(knight.x, knight.y)
UpdateSprites()KnightWalk()
:
//Draw 9 arrows for direction
Arrows(800,1040,red,green,blue,0)
Arrows(750,990,red,green,blue,90)
Arrows(850,990,red,green,blue,-90)
//6 more arrow function calls
:
playMusic()update()
repeat:
Function Arrows(trx,try,col1,col2,col3,rot)
gw=1950/30
gh=1080/30shape1=createTriangle(gw/3+trx, gh/3+try, gw/3+gw/3+trx, gh/3+try, gw/2+trx, gh-gh/3+try)
setVertexColour(shape1,0,col1)
setVertexColour(shape1,1,col2)
setVertexColour(shape1,2,col3)rotateshape(shape1,rot)
drawShape(shape1)
//update()
return voidEven with 1 Arrows function call looses memory slowly and it crashes
In the knightWalk function it also calls the Arrows function to highlight the direction when the knights button are pressed. Currently those Arrows function calls are commented out. However, it would look like this:
Arrows(800,1040,red,white,blue,0)So it appears my function Arrows is too complicated and looses memory
-
This post might help...
https://fuzearena.com/forum/topic/107/stack-overflow-with-controls-n/8
-
I think you are losing memory because you are not doing deleteShape() on your arrows after you have drawn them.
This is a serious bug in Fuze, since memory allocated for shapes is not returned even after you quit your program (same as with audio files).
-
@n_yohan thanks but adding another update() or sleep(0.0001) or smaller causes the music and character movement to be very slow and not realistic to use. As well also causes the memory loss and eventual crashing- just slower.
-
-
Thank you! That did the trick. All is fully functional again - back to normal. I’ve learned so much with the members and staff in this forum. Great work!
-
If you notice on the last screen capture there is now a colorful “Action” menu box displayed with selectable smaller menu boxes (ie Inventory, Pause, Take, Look...). I’m able to select each menu box (into high-lighted black boxes with red letters) using the control buttons l, lz, r and rz when pressed. However there are 11 menu boxes and not enough control buttons (as I’m using 4 buttons also to control the animated knight walking).
Does anyone have ideas or code to share on how I might cycle through 1 or 2 buttons to have them go through the menus. I was thinking a counter but when the button is released have it count and move to the next menu box. Is that the right way to handle a situation like this?
thanks - Tim.
-
@tdg8934 It's been a while since I've played the Mega Drive version... how did that work? The Genesis only had three face buttons, yet I remember it having the little boxes, and I recall the control scheme working just fine.
I actually have a copy of the Genesis port sitting around my basement somewhere...
-
@tdg8934 you could have a box (invisible sprite or area) where your inventory is and detect some form of collision while in there just call the collision and put the controls needed in there that will allow you to use one button for multi purpose. There may be a better way but its worked for me.
-
@vinicity said in New to Fuse4-want a Faery Tale Adventure like game:
I think you are losing memory because you are not doing deleteShape() on your arrows after you have drawn them.
This is a serious bug in Fuze, since memory allocated for shapes is not returned even after you quit your program (same as with audio files).
We're aware of this and have a fix coming your way soon for shape memory not freeing at program end. In your programs however it's always possible to leak memory if you createShape with no deleteShape!
-
@Willpowered thank you and I am using the DeleteShape command which is working for me to fix the problem.
-
I haven’t been able to find a method that counts the number of times a control button is pushed. So if c.l is pushed once it does thing 1, if c.l is pushed twice it does thing 2, for let’s say 5 pushes .
I’ve searched “control“ and can’t find a routine that does this.
Anyone have ideas?
Thank you
-
Counting button presses isn’t so straightforward. You might think you can just make a ‘counter’ variable then put ‘if c.l then counter = counter + 1’, but that will just zip up your counter super fast, 1 per frame. I haven’t done it yet, but my question here: https://fuzearena.com/forum/topic/1195/use-of-flags-with-button-presses will probably be relevant. Maybe.
-
I’d recommend counting when the player lifts their finger as a button press. In my programs, you will often see I don’t make an action occur until then, so as to only have registered the action once.
If you look at my small Game States Demo in the TitleScreen() function, there’s a spot where aPressed==false, meaning they let go of “c.a”. You could increment a global variable count in that spot, such as buttonAcount+=1, and then check if it’s the right count, and then do the action and reset.
-
I found a way to make it work with a pseudo mouse like movement using the analog stick lx ly. I found the JoinShape demo in the help. I shows a circle shape moving around the screen with the left analog stick. I Reduced the circle shape radius to 10 and used the Distance command between the shape and each of the menu boxes. When the circle shape is moved over the top of the menu box it changes to a black box with red letters and then unloads the old map and loads a new one. Its not ideal as I would rather press a button to cycle through the menu boxes - but it works for the most part.
Not sure what to work on next but it’s coming along.
Thanks to everyone!
-
I figured out how to press a single control button and cycle through tasks without having to use the pseudo mouse method figured out using similar code from the “JoinShape” example help command.
This better method of cycling through tasks was found using the Example help on the command “setShapeColour”.
w = 150 press = false pressCount = 0 loop clear j = controls(0) MenuPress() update() repeat function MenuPress() if j.a and !press then pressCount += 1 if pressCount >= 12 then pressCount = 0 endif press = true endif if !j.a then press = false endif if pressCount == 1 then drawImage( menubox_action, w*6, 930, 1) endif if pressCount == 2 then drawImage( menubox_inventory, w*6, 930+30, 1) endif : : if pressCount == 11 then drawImage( menubox_r, w*6+w/8+92. 930+10, 1) endif return void
-
@tdg8934 if you surround your code blocks with ``` it will format it properly (as above)
-
@pianofire great I was wondering how others did that. Guess I should look closer at the reply options.