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

#1 2013-03-09 22:04:46

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Platformer Engine not working

Hello Everybody,
I'm currently working on a scrolling platformer.  I'm working on a base for it, and I have a huge problem with it.  The engine has a large color fractal script that has one part managing the xvel variable.  It looks like this:

when gf clicked
repeat until <(won) = [1]>
    ...
    if <not<touching color [grey]>>
        ...
        if <key [right arrow v] pressed>
            change [xvel2 v] by 0.05
        end
    end
end
This did not work.  The variable xvel2 was not changing at all.
I then though that the booleans were wrong.  I checked with a script that said:
when gf clicked
forever
    say <join <touching color [grey]> <key [right arrow v] clicked>>
end
The phrase when I pressed the right arrow was always "falsetrue"  Therefore, the booleans should have been working right.

Does anyone see anything I overlooked?  If you need to see the full script, I'll upload.

Thanks,
Programmer_112

Last edited by Programmer_112 (2013-03-09 22:05:34)


http://i49.tinypic.com/rk60py.png

Offline

 

#2 2013-03-10 13:19:48

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Platformer Engine not working

I looked through your script, and ignoring the blanked-out parts, it should be working, so I'm predicting that something's going wrong in the parts of your script that you didn't show. So, could you show them?

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#3 2013-03-10 15:04:30

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

OK, I'll head what I have so far as soon as I can.
EDIT: Here is what I have so far.  My broken project.  sad

Last edited by Programmer_112 (2013-03-10 15:24:31)


http://i49.tinypic.com/rk60py.png

Offline

 

#4 2013-03-10 19:28:00

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Platformer Engine not working

Programmer_112 wrote:

OK, I'll head what I have so far as soon as I can.
EDIT: Here is what I have so far.  My broken project.  sad

Okay, I'll be looking at it sometime soon.  wink

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

#5 2013-03-10 19:37:44

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

ErnieParke wrote:

Programmer_112 wrote:

OK, I'll head what I have so far as soon as I can.
EDIT: Here is what I have so far.  My broken project.  sad

Okay, I'll be looking at it sometime soon.  wink

With regards,

ErnieParke

Thanks!


http://i49.tinypic.com/rk60py.png

Offline

 

#6 2013-03-10 20:24:19

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Platformer Engine not working

What does the variable "won" display?


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#7 2013-03-10 20:37:10

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

Firedrake969 wrote:

What does the variable "won" display?

Should be 1, but I might have glitched it.  Sadly, my dad just banned me from the computer for the rest of today for some reason.  I'll check as soon as possible.

Last edited by Programmer_112 (2013-03-10 20:40:26)


http://i49.tinypic.com/rk60py.png

Offline

 

#8 2013-03-11 21:28:37

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

Firedrake969 wrote:

What does the variable "won" display?

"won" is reporting 0.

Last edited by Programmer_112 (2013-03-11 21:28:47)


http://i49.tinypic.com/rk60py.png

Offline

 

#9 2013-03-16 12:18:47

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

Does anyone have any idea what the problem is?


http://i49.tinypic.com/rk60py.png

Offline

 

#10 2013-03-16 12:46:21

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Platformer Engine not working

Programmer_112 wrote:

Does anyone have any idea what the problem is?

Sorry for not responding earlier, though yes, I do know what the problem is, and it's not with the script that you showed us above. So let's look at this script instead:

when gf clicked
forever
 change y by (yvel2)
 if <(x position) < (0)>
  Run scripts...
 else
  change x by (xvel2)
 end

Well the problem this is causing is that your person is always below 0, and so it's x position never gets changed. Once you fix that, you should be good. ;)

I hope that this helps!

With regards,

ErnieParke

Last edited by ErnieParke (2013-03-16 12:46:38)


http://i46.tinypic.com/35ismmc.png

Offline

 

#11 2013-03-16 13:01:41

Harald
New Scratcher
Registered: 2013-03-05
Posts: 34

Re: Platformer Engine not working

I don't know how you want this little creature to behave, but currently you have a script
that forever sets xvel2 to 0.92 * xvel
There's nothing changing the value of xvel, causing xvel2 to stay at 0 forever..

Offline

 

#12 2013-03-16 13:24:34

Programmer_112
Scratcher
Registered: 2012-02-17
Posts: 100+

Re: Platformer Engine not working

ErnieParke wrote:

Programmer_112 wrote:

Does anyone have any idea what the problem is?

Sorry for not responding earlier, though yes, I do know what the problem is, and it's not with the script that you showed us above. So let's look at this script instead:

when gf clicked
forever
 change y by (yvel2)
 if <(x position) < (0)>
  Run scripts...
 else
  change x by (xvel2)
 end

Well the problem this is causing is that your person is always below 0, and so it's x position never gets changed. Once you fix that, you should be good. ;)

I hope that this helps!

With regards,

ErnieParke

Oh.  Thanks!


http://i49.tinypic.com/rk60py.png

Offline

 

#13 2013-03-16 13:38:27

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: Platformer Engine not working

Programmer_112 wrote:

ErnieParke wrote:

Programmer_112 wrote:

Does anyone have any idea what the problem is?

Sorry for not responding earlier, though yes, I do know what the problem is, and it's not with the script that you showed us above. So let's look at this script instead:

when gf clicked
forever
 change y by (yvel2)
 if <(x position) < (0)>
  Run scripts...
 else
  change x by (xvel2)
 end

Well the problem this is causing is that your person is always below 0, and so it's x position never gets changed. Once you fix that, you should be good. ;)

I hope that this helps!

With regards,

ErnieParke

Oh.  Thanks!

Well it's nothing.

With regards,

ErnieParke


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer