It seems that the behavior "spawactor" causes jerk

galbangalban Member Posts: 62
edited November -1 in Working with GS (Mac)
It seems that the behavior "spawactor" causes jerk. I created an actor "canon" in my game that missiles every 5 seconds. When I test my game on IPAD, the scrolling jerks every 5 seconds (even with 3 or 4 canons...). if i delete canons in my game, the scrolling is smooth

how to avoid this effect please ?

Comments

  • StusAppsStusApps Member, PRO Posts: 1,352
    Make them be already there but invisible with an alpha set to 0, then just change their alpha to 1 when they appear.
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Yes, spawning is processor intensive. Especially if the cannonballs have Rules in them.

    If possible, move the collision Rules to the Actors that the cannonball is supposed to hit, rather than in the cannonball itself.

    A better method would be to have your cannonballs already sitting off-screen. When you fire the cannon, simply move them to the right place. When the cannon ball is destroyed, move it back off-screen instead of destroying it.
  • quantumsheepquantumsheep Member Posts: 8,188
    I just love the title of this thread :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • JamesZeppelinJamesZeppelin Member Posts: 1,927
    Also anything with a sound can cause a hiccup

    Is it noticeably worse on the very first time?

    If that's the case you can fix it by having it's sound play one time at no volume when the level loads so that the sound doesn't load into the memory during the middle of gameplay

    But again that is only if it is worse the first time
  • galbangalban Member Posts: 62
    Thanks , I'll test alpha = 0 and alpha = 1
  • galbangalban Member Posts: 62
    Do you know if there are a sample with the method of "StusApps " on gamesalad forum
    Because it's easy with one canon, but if there are 10 canons how to determine the cannonballs to use ?
  • StusAppsStusApps Member, PRO Posts: 1,352
    galban said:
    Do you know if there are a sample with the method of "StusApps " on gamesalad forum
    Because it's easy with one canon, but if there are 10 canons how to determine the cannonballs to use ?

    I don't really know the specifics of your game, but if you have 10 canons then create 10 global boolean attributes (one for each). When the canon needs to be visible set that attribute to true, within each canon have a rule to change to visible when that attribute is true.
  • galbangalban Member Posts: 62
    In my game, my canons spawactor "fire"
    if i place 10 instances of actors "fires" on the screen, i don't know how to determine what fire display because all instances have the same name "fire"
  • galbangalban Member Posts: 62
    this technic seems very complicated. if i use it, i must change all the levels of my game

    In the manual, i can read "Spaw actor" : good for "firing" projectilles.
    So i don't understand why it's causes jerk, even if my projectilles have not rules !
  • StusAppsStusApps Member, PRO Posts: 1,352
    oh i see. It's the canon ball that is spawning, not the canon.

    How big is the graphic for the ball?
  • galbangalban Member Posts: 62
    No, png 12*26
  • StusAppsStusApps Member, PRO Posts: 1,352
    very strange. In break beat I was spawning about 8 (15x15) balls every 4 seconds as well as spawning a load of 80x80 blocks at the same time. The only time that would cause slowdown was when there were already a load of actors already on the screen. What's the current memory and fps like when just running the game without the cannons firing?
  • galbangalban Member Posts: 62
    whithout the canons my game is perfect.
Sign In or Register to comment.