Topic:   SC Reminder   (Read 15588 times)


0 Members and 2 Guests are viewing this topic.

WarHampster


  • GMG Extraordinaire

  • ***


  • Posts: 1501

  • The People's Moderator
    • Arcade of the Absurd
SC Reminder
« on: October 30, 2010, 08:58:13 PM »
Reminder to all SilverCreator programmers: ALWAYS make use of the extra boolean parameter on sprite commands. For example, MOVESPRITE 1,x,y should be MOVESPRITE 1,x,y,1.

From the SC manual:

Quote
updateScreen Parameter

Explanation

This is an optional parameter available on most sprite commands. When you pass TRUE to this parameter, the runtime will suppress the next screen update.

Each use of a sprite command causes an immediate screen update, reflecting the changes caused by the command. While this makes simpler games easier to code, sometimes this is not desirable for speed or aesthetic purposes.

Examples

// When you run this code, you will see each sprite briefly
// as it is transformed by each sprite command.
CREATESPRITE 1, "rocket"
MOVESPRITE 1, 50, 50
SCALESPRITE 1, 75
TINTSPRITE 1, 35, 35, 35, 50

// When you run this code, you will only see the final
// transformed sprite. This code will also run faster.
CREATESPRITE 1, "rocket"
MOVESPRITE 1, 50, 50, TRUE
SCALESPRITE 1, 75, TRUE
TINTSPRITE 1, 35, 35, 35, 50   // we don't put TRUE here, which causes the screen to update

Related Items

None.

Forgetting to tell SC to wait to update the screen will in most cases result in terrible lag!

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: SC Reminder
« Reply #1 on: October 31, 2010, 04:08:09 AM »
Awesome. In GM we set the sprout's layer to a negative value and the sprite(s) won't update the screen untill a positive value layered sprite is drawn.

EDIT:

LOL! Sprout's? Ruddy iPhone...
« Last Edit: October 31, 2010, 04:10:55 AM by Silverwind »
I survived the spammage of 2007

Charlo


  • GMG-er

  • **


  • Posts: 451
Re: SC Reminder
« Reply #2 on: October 31, 2010, 04:17:26 PM »
This feature is especially useful for level rendering.  Seeing all the sprites of the level appear one at a time over the course of a half-second isn't very good-looking.  ;)

GMG Mike


  • Administrator

  • GMG-er

  • *****

  • no avatar

  • Posts: 536
    • mikerichardson.name
Re: SC Reminder
« Reply #3 on: November 01, 2010, 10:50:57 PM »
I might make it a checkbox in future versions, for all sprite commands to assume TRUE for the extra boolean parameter unless you specifically say FALSE. This would be a per-project checkbox.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: SC Reminder
« Reply #4 on: November 02, 2010, 07:58:31 PM »
Sounds good to me, that would keep the feature in but make things easier for when you dont need it
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/