Sprite comparisons (sort of) work now

Help and questions on programming the codebug
Post Reply
mikerr
Posts: 83
Joined: Fri Jul 31, 2015 10:37 am
Contact:

Sprite comparisons (sort of) work now

Post by mikerr » Thu Aug 27, 2015 5:20 pm

Saw this sketch is working:

http://www.codebug.co.uk/explore/codebu ... e-compare/

So tried my own, but couldn't get much working:

http://www.codebug.co.uk/explore/codebu ... e-compare/

I know the problem is that the working version generated the following class-based comparison:

Code: Select all

if (sprite0.is_equal(sprite1))
whereas my non-working sketches generate

Code: Select all

if (screen == new CharSprite('A'))
A small change, if only we could edit that code-viewer window !!
Last edited by mikerr on Thu Aug 27, 2015 10:06 pm, edited 1 time in total.
Twitter @mikered codebug profile mikerr

pigraham
Posts: 65
Joined: Sat Aug 15, 2015 1:41 pm

Re: Sprite comparisons (sort of) work now

Post by pigraham » Thu Aug 27, 2015 7:09 pm

That's interesting. I didn't know sprites could be compared.

BMS Doug
Posts: 61
Joined: Wed Aug 26, 2015 8:54 am
Contact:

Re: Sprite comparisons (sort of) work now

Post by BMS Doug » Fri Aug 28, 2015 7:47 am

I wonder if it is because you are comparing two different types of items (even though one is generated from the other).

Two different types of items can be compared to see if they are exactly the same but it handles it in a different way than comparing identical items.

Nope, doesn't seem to be the case.

The code viewer box doesn't seem to update everytime you open it. I'm gonna run through some variables.


Edit: fixed link
Last edited by BMS Doug on Fri Aug 28, 2015 9:18 am, edited 2 times in total.

BMS Doug
Posts: 61
Joined: Wed Aug 26, 2015 8:54 am
Contact:

Re: Sprite comparisons (sort of) work now

Post by BMS Doug » Fri Aug 28, 2015 8:14 am

It seems to be that the sprite has to be initially set before the comparison will work.

This variant seems to achieve what you were looking for.

I don't know if this will work, I don't have my CodeBugs yet.

Edit: fixed link
Last edited by BMS Doug on Fri Aug 28, 2015 9:18 am, edited 1 time in total.

pigraham
Posts: 65
Joined: Sat Aug 15, 2015 1:41 pm

Re: Sprite comparisons (sort of) work now

Post by pigraham » Fri Aug 28, 2015 8:56 am

BMS Doug wrote:It seems to be that the sprite has to be initially set before the comparison will work.

This variant seems to achieve what you were looking for.

I don't know if this will work, I don't have my CodeBugs yet.
Is that set to private? I get Error 403 Forbidden when I click the link.

BMS Doug
Posts: 61
Joined: Wed Aug 26, 2015 8:54 am
Contact:

Re: Sprite comparisons (sort of) work now

Post by BMS Doug » Fri Aug 28, 2015 9:12 am

pigraham wrote:
BMS Doug wrote:It seems to be that the sprite has to be initially set before the comparison will work.

This variant seems to achieve what you were looking for.

I don't know if this will work, I don't have my CodeBugs yet.
Is that set to private? I get Error 403 Forbidden when I click the link.
No, But I when copied the URL from the webpage it was from edit mode, here is a working link: http://www.codebug.co.uk/explore/codebug/497/

I learn more about using the codebug site every day: the original link was to the Create folder so will only allow me (the creator) to view it. For anyone else they will have to view it from the explore folder.

tomp
Posts: 1
Joined: Fri Aug 28, 2015 12:32 pm

Re: Sprite comparisons (sort of) work now

Post by tomp » Fri Aug 28, 2015 12:35 pm

Anonymous sprite comparison is now fixed. ;)

Post Reply