This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-04-21 14:12:40

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

1s1s Pong - score stamping

I'm trying to make a 1s1s where the score is displayed as you're playing, not just when you die. The problem is, as you can imagine, it's laggy to the point where it's unplayable. Can anyone think of any way to make the score display while the user's playing while keeping it playable? Thanks. The project can be found here.

Last edited by RedRocker227 (2012-04-21 14:13:00)


Why

Offline

 

#2 2012-04-21 14:23:03

zammer990
Scratcher
Registered: 2012-01-22
Posts: 500+

Re: 1s1s Pong - score stamping

Your game constantly switches costume sand has to so that'd be laggy anyway. To display score simply set the variable to visible


http://i45.tinypic.com/2ynq7nn.jpg Play now!

Offline

 

#3 2012-04-21 14:28:23

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

zammer990 wrote:

Your game constantly switches costume sand has to so that'd be laggy anyway. To display score simply set the variable to visible

Without the score it's only laggy in editing mode - in full-screen and online it doesn't lag in the slightest. And I'm not a fan of making variables visible, they look messy in my opinion (it would look especially messy in this one, since it wouldn't fit the theme at all).


Why

Offline

 

#4 2012-04-21 14:30:17

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: 1s1s Pong - score stamping

I think the reason that it is lagging is because there are three stampings at a time. The ball and paddle are both changing at the same time, the program can't process it, and that creates a "hide-show" on and off effect. Adding the score just adds to the problem, making the computer stamp three things almost at once.

I don't think anything is wrong with the scripting--I thinks that's fine, but continuos stamping causes the lag. There are a few 1s1s games I have seen that use different costumes as sprites, but not having them stamp multiple costumes at different times.

I would suggest a more intervalled (or however you spell it  smile   ) timer for stamping (like every 5 seconds), or just create a time variable (or timer) to be shown how much time you went before you lost.

My number 100 post!!!  smile


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#5 2012-04-21 15:01:41

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

mythbusteranimator wrote:

I think the reason that it is lagging is because there are three stampings at a time. The ball and paddle are both changing at the same time, the program can't process it, and that creates a "hide-show" on and off effect. Adding the score just adds to the problem, making the computer stamp three things almost at once.

I don't think anything is wrong with the scripting--I thinks that's fine, but continuos stamping causes the lag. There are a few 1s1s games I have seen that use different costumes as sprites, but not having them stamp multiple costumes at different times.

I would suggest a more intervalled (or however you spell it  smile   ) timer for stamping (like every 5 seconds), or just create a time variable (or timer) to be shown how much time you went before you lost.

My number 100 post!!!  smile

That's a great idea! The one where it only stamps the score every, say, one second, that is. I'll test it later.  smile


Why

Offline

 

#6 2012-04-21 16:33:12

afatethatwedeserve
New Scratcher
Registered: 2012-04-19
Posts: 5

Re: 1s1s Pong - score stamping

Ugh, it doesn't work. I didn't think of the fact that since it clears the screen at the start of every "iteration" (right word?), if it only stamps the score every, say, ten iterations, the score will still be flashing loads. Anyone got any other solutions?

This is RedRocker by the way.

Offline

 

#7 2012-04-21 16:50:35

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: 1s1s Pong - score stamping

I was looking at your script and I saw "repeat (length of(score) )" and I immediately thought "well, that's probably the problem".  The inherent delay in the repeat block is what is causing the lag (I removed it and it is fine).

I hate to say it, but I think you have to replace that loop with a ton of if statements.  It means that the score thing will glitch (eventually), but using a loop is really just too slow  hmm

if(length > 1)
{
     print first letter
     if(length > 2)
     {
          print second letter
          if(length > 2)
          {
                etc.
          }
    }
}


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#8 2012-04-21 16:57:47

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

MoreGamesNow wrote:

I was looking at your script and I saw "repeat (length of(score) )" and I immediately thought "well, that's probably the problem".  The inherent delay in the repeat block is what is causing the lag (I removed it and it is fine).

I hate to say it, but I think you have to replace that loop with a ton of if statements.  It means that the score thing will glitch (eventually), but using a loop is really just too slow  hmm

if(length > 1)
{
     print first letter
     if(length > 2)
     {
          print second letter
          if(length > 2)
          {
                etc.
          }
    }
}

I'm probably just being incredibly dumb, but I don't see how that differs from the current script (apart from the block structure, obviously) - it'd still repeat the same amount of times, and it'd probably even take longer, since it needs to check the boolean every time it runs. Can you explain why that'd be better than the current method? (I'm gonna look so stupid when I realise it, haha)


Why

Offline

 

#9 2012-04-21 17:08:55

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: 1s1s Pong - score stamping

RedRocker227 wrote:

I'm probably just being incredibly dumb, but I don't see how that differs from the current script (apart from the block structure, obviously) - it'd still repeat the same amount of times, and it'd probably even take longer, since it needs to check the boolean every time it runs. Can you explain why that'd be better than the current method? (I'm gonna look so stupid when I realise it, haha)

Basically, every "C" block has a slight delay built in.  If you have a project with this:

when gf clicked
go to x:(0) y:(0)
forever
change x by (3)
The sprite won't immediately zoom right across the screen because there is a very slight delay between the finishing of the execution of the "change x" block and the looping back to the top of the loop.  One of the main things that turbo mode does is eliminate this slight delay.

Back to your code.  Putting it all in "if" blocks means it doesn't have to go through a loop, so it won't have that delay.

Edit: you should put a strikethrough through your forum's name  tongue

Last edited by MoreGamesNow (2012-04-21 17:10:49)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#10 2012-04-21 17:16:30

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

MoreGamesNow wrote:

RedRocker227 wrote:

I'm probably just being incredibly dumb, but I don't see how that differs from the current script (apart from the block structure, obviously) - it'd still repeat the same amount of times, and it'd probably even take longer, since it needs to check the boolean every time it runs. Can you explain why that'd be better than the current method? (I'm gonna look so stupid when I realise it, haha)

Basically, every "C" block has a slight delay built in.  If you have a project with this:

when gf clicked
go to x:(0) y:(0)
forever
change x by (3)
The sprite won't immediately zoom right across the screen because there is a very slight delay between the finishing of the execution of the "change x" block and the looping back to the top of the loop.  One of the main things that turbo mode does is eliminate this slight delay.

Back to your code.  Putting it all in "if" blocks means it doesn't have to go through a loop, so it won't have that delay.

Edit: you should put a strikethrough through your forum's name  tongue

Ah, gotcha.  tongue

I was right, I do feel stupid, haha.

Thanks.


Why

Offline

 

#11 2012-04-22 04:27:22

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

Bump. I'll try ^that^ method later, but I'm still open to more methods. ;P


Why

Offline

 

#12 2012-04-23 11:12:02

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: 1s1s Pong - score stamping

How about instead of having the paddle glide, have it change,say, 15 x-pos every time the arrow is pressed? It wouldn't make it smoother (it would be a little choppier), but I don't know if it owuld stop the glitching. :\


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#13 2012-04-25 12:41:29

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: 1s1s Pong - score stamping

^It already did that.  tongue

And MoreGamesNow's method worked. Thanks, MoreGamesNow.  smile


Why

Offline

 

#14 2012-04-25 18:21:15

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: 1s1s Pong - score stamping

RedRocker227 wrote:

^It already did that.  tongue

And MoreGamesNow's method worked. Thanks, MoreGamesNow.  smile

I live to serve  big_smile


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#15 2012-04-28 00:36:04

darthvader111
Scratcher
Registered: 2010-03-12
Posts: 45

Re: 1s1s Pong - score stamping

RedRocker227 wrote:

zammer990 wrote:

Your game constantly switches costume sand has to so that'd be laggy anyway. To display score simply set the variable to visible

Without the score it's only laggy in editing mode - in full-screen and online it doesn't lag in the slightest. And I'm not a fan of making variables visible, they look messy in my opinion (it would look especially messy in this one, since it wouldn't fit the theme at all).

If you don't like the messy variables, try to first add ten costumes:

Costume 1: The Number One

Costume 2: The Number Two

Costume 3: The Number Three

Costume 4: The Number Four

Costume 5: The Number Five

Costume 6: The Number Six

Costume 7: The Number Seven

Costume 8: The Number Eight

Costume 9: The Number Nine

Costume 10: The Number Ten


Secondly, add the scripts. Use whatever scripts necessary in your project, just make sure to use stamping if you want your project to be 1s1s.

Offline

 

#16 2012-04-28 01:01:48

TorbyFork234
Scratcher
Registered: 2012-03-01
Posts: 1000+

Re: 1s1s Pong - score stamping

darthvader111 wrote:

RedRocker227 wrote:

zammer990 wrote:

Your game constantly switches costume sand has to so that'd be laggy anyway. To display score simply set the variable to visible

Without the score it's only laggy in editing mode - in full-screen and online it doesn't lag in the slightest. And I'm not a fan of making variables visible, they look messy in my opinion (it would look especially messy in this one, since it wouldn't fit the theme at all).

If you don't like the messy variables, try to first add ten costumes:

Costume 1: The Number One

Costume 2: The Number Two

Costume 3: The Number Three

Costume 4: The Number Four

Costume 5: The Number Five

Costume 6: The Number Six

Costume 7: The Number Seven

Costume 8: The Number Eight

Costume 9: The Number Nine

Costume 10: The Number Ten


Secondly, add the scripts. Use whatever scripts necessary in your project, just make sure to use stamping if you want your project to be 1s1s.

He already made the game.

Offline

 

Board footer