We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rotate LDPolygon
#1
(translated by Google translator)

Hi all.
Please tell me, does anyone know of any problems using the rotate "Shapes.Rotate()" function?
I have uncontrolled displacement of the "LD Polygon" shape when I rotate it.
This displacement does not always occur. And the displacement can be different.  Huh

Thank you.
Reply
#2
Hi,

Do you have an example, the following works for me.  Most shapes/controls rotate about their bounding box centre, lines are an exceptions and tricky to rotate.

Code:
Polygon1 = LDShapes.AddPolygon("1=1\=0\;2\=50\;;2=1\=34.5\;2\=97.6\;;3=1\=90.5\;2\=79.4\;;4=1\=90.5\;2\=20.6\;;5=1\=34.5\;2\=2.4\;;")
Shapes.Move(Polygon1,100,100)
For i = 1 To 360
  Shapes.Rotate(Polygon1,i)
  Program.Delay(10)
EndFor
Reply
#3
(translated by Google translator)

I was writing code for my "AI Snake". I completed the Snake's manual movement module and tested how it works.
Everything was normal.
Then I began to write a module for analyzing the current situation. In my code, the analysis of the situation does not in any way affect the calculation of the position of the figures on the playing field. But, at this moment I updated SB-Prime from the program.

After the SB-Prime update, quite a lot of text disappeared in the menu lines that appear when you right-click on the text field. The title text of the "Debug" tab has also disappeared. Then I downloaded the SB-Prime archive from the site using a browser, and launched SB-Prime from the archive. But the text in SB-Prime was still missing. And I continued writing code, ignoring the lack of text in the menu.
I thought these were temporary minor problems that would be fixed quickly. But then errors appeared in the work of my “Snake”.

Every time I changed the direction of the Snake's movement, its head began to occupy the wrong position relative to the rest of the body.
I checked the code, but the code has not changed.
I started using the old version of SB-Prime again, but the problem with the position of the Snake's head did not disappear.
Then I turned to the forum for help.
If I have to write and test a separate code example, then I will do it.
But first, I probably should install the SB-Prime update correctly.

I'm right?
[-] The following 1 user Likes AbsoluteBeginner's post:
  • z-s
Reply
#4
Could you share code with error
ZS
Reply
#5
AB, There is an issue with translation when I update SB-Prime.  I will try to fix now.  I have no idea why it happed, but Scout I think saw it before - not all window text gets converted properly, some seem to randomly be missed?

EDIT

Looks like it was something to do with trying to do the language translations in parralel, but I'm not really sure.

Anyway I uploaded a version with this hopefully fixed.
Reply
#6
Yes,.. everything is fine now.
SB-Prime works like a clock.  Tongue

Now I'll check my code again. If I don't find the error, I'll give the code to Z-S so he can look at it if he wants.
And then I'll give up using rotation of one shape and just create four shapes, rotated in different directions.

Thanks a lot to everyone!

(05-15-2024, 11:50 AM)z-s Wrote: Could you share code with error

ZS, thank you very much for your support.
I'll do another check myself.
If I can't find the error, I'll pass the code on to you.  Smile
[-] The following 2 users Like AbsoluteBeginner's post:
  • litdev, z-s
Reply
#7
(translated by Google translator)

This is the information I was able to extract.
I have two versions of the code: version 0.35 and version 0.36.
I couldn't visually find the differences in their code.
But... Version 0.35 never made errors during tests. But version 0.36 drew the Snake's head incorrectly in about 75% of tests.
In about one case out of four, version 0.36 worked correctly.

Dear LitDev, please tell me what the items in the context menu that talk about “Comparison” mean?
And how to use it?

Thank you.  Shy
Reply
#8
The compare options were there as a button using the split screen in the version before I introduced the docking stuff.  It shows the differences between 2 documents.

Open the 2 documents, and usually I put them side-by-side.  Then in first document use the context menu to set first file to compare, then in the other document use the context menu to set the second file to compare.  You should then see the differences in the files highlighted in red in the first and green in second.

I sometimes open the unedited version of the same program to check changes I have made before saving.

EDIT

Just fixed a bug where SB-Prime could crash if a document window is closed while it is doing a difference.
[-] The following 1 user Likes litdev's post:
  • AbsoluteBeginner
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)