Fixing after the update



  • So I’ve finally found time to look at my games broken after the update, and read over the help for the common problems. I’m still stuck and really, really hoping someone can help with my Eye of the Switch Warrior game (HQ4L3MNDXH, pending).

    From what I can tell, the problems seem to occur when setting properties for multiple of the same sprite through for-loops. For example:

    array spider[10]  createenemy (spider, enemies, 20, red)
    for a = 0 to 10 loop  spider[a].rest = 1  repeat 
    

    ... will return Invalid variable access error. Later on, using a for-loop in the same way to setspritecolour(dragon[a], blue) will return Incorrect type int. There are others.

    It’s all frustrating as I was hoping to enter this for the gallery. There may be a better place in the forum for this post so please move if so :)


  • Fuze Team

    Hi Andy - I've taken a look at this and the fix seems to be to add the "ref" keyword before the "spritename" parameter in your createenemy() function define. I believe it's line 519, unless I forgot about moving something else around.

    The reason for this is you are passing an array to the function with the intention of referencing it in the function and changing the contents of it using the variable local to that function "spritename".

    It should read:

    function createenemy( ref spritename, spritesheet, animstart... etc )
    

    This has to now be specified as pass by reference here, in order to have your changes actually apply to the passed array.

    Game looks awesome by the way - well worth a Showcase submission :) I had a couple of questions about it as I couldn't seem to attack the enemies I came across - how do I attack with a weapon?

    Also - if you're unfortunate enough to have bad Joy-Con drift, it makes moving around a real nightmare. Perhaps a choice between joystick movement or d-pad movement at the start of the game would be helpful. This way, if a user knows their Joy-Con's aren't doing too well, they can select D-pad move and not have to worry.



  • Wow, fantastic stuff! The simple addition of 3 letters has fixed everything! Well, I will just double-check the collision areas and play it to completion a few times to double-check :).

    It sounds like I also need to update the instructions so they’re clearer... (but to answer the question, battle is automatic - you just need the right weapon!)

    Thanks a lot for your help :D


  • F

    Maybe add a deadzone to the analogue controls? That is usually very helpful for combating the dreaded drift...



  • @vinicity I haven’t heard of that before. Do you mean like detecting where the player’s analog is and setting that as default?



  • I can recommend a "threshold" value for c.lx, c.ly, etc.

    For example,
    If abs(c.lx)>threshold then
    // do action associated with c.lx


  • F

    @DaddyJDM said in Fixing after the update:

    I can recommend a "threshold" value for c.lx, c.ly, etc.

    For example,
    If abs(c.lx)>threshold then
    // do action associated with c.lx

    That’s what I meant when talking about adding a deadzone.

    The "joystick deadzone" is the area around the center of a joystick that does not respond to movement.


Log in to reply