# mahreen miangul JuLy 2018

• ### Question

•  Parallelogram by Turtle from mahreen miangul ID VSL220
mahreen miangul
Sunday, July 1, 2018 12:44 PM

• Hi Mahreen, nice drawing by Turtle with colorful edges and also filled!

Nonki Takahashi

• Marked as answer by Tuesday, July 3, 2018 12:09 PM
Monday, July 2, 2018 10:17 AM
• Hi Mahreen, how about changing lines 67-75 as follows?

```' Car  Reverse Moving  X,Y  Direction
cycleX= shapes.GetLeft(shp[NMB][1])
cycleY= shapes.GetTop(shp[NMB][1])
If cycleX<0 Or cycleX>GraphicsWindow.Width-60 Then
ddx=-ddx
EndIf
If cycleY<20 Or cycleY>GraphicsWindow.Height-80 Then
ddy=-ddy
EndIf```

Nonki Takahashi

Sunday, July 8, 2018 2:48 AM
• Did you replace the lines 67-75 with the programpart in Nonki's posting of July 8th? Then the car with green ellips (= shape nr 8 ) is responding to SWAT  If you want to move another car, change the number NMB="8:1""  to NMB="x:1", where x is the number of the shape.

Hint: when you change an aircraft to a car, change also in the comments aircraft to car.

Do you need the apples in this program?

Jan [ WhTurner ] The Netherlands

• Marked as answer by Thursday, July 12, 2018 5:16 AM
Monday, July 9, 2018 5:55 PM
• You have to put in line 34 the shapenumber of the car you want to move with SWAT e.g.

NMB="8:1"  '  Aircraft shapes number=5   repeat =1    for the second car from the left,  or  "7:1" for the first car.

Can you describe in words what you want the program to do:

- draw four cars

- put the first car in motion with the keys SWAT

- move the third car by pushing one of the arrow keys

--...   other things you want to do (draw apples...)

It then easier to see what the purpose of different parts of the program should do.

Jan [ WhTurner ] The Netherlands

• Marked as answer by Thursday, July 12, 2018 1:54 PM
Thursday, July 12, 2018 9:49 AM
• When I ran your program I noticed the collitioncheck didn't work well.
I wrote some experimental programs to try to understand how to detect collisions.
A circle aproaching from the left and a rectangle collide when the left coordinate
of the circle is at a distance of the size of the circle from the left coordinate
of the rectangle (in your program this is 40 pixels). I changed the If statement
in the collition check (line 77) with this correction (left side and top side).

The collition then didn't work right. I found you check the collition of the ball
with the left rear wheel (shape[1][3]) This should be the body of the car (shape[1][5]),
in lines 58 and 59 you calculate cycleX and cycleY from shp[NMB][3], should be [5].
In lines 60 and 63 you use shape[5][3]. As there is no shape[5] this is always zero.
Use shape[1][5].
After testing with these changes there still was something wrong  with the collition
detection. In line 77 the use of shape[1][53]["height"] uses the size of the shape as
defined in the subroutine, but doesn't take the size factor into account, the size
has to be magnified by ss.

I didn't do anything about your other questions, as the above changes has to work first.
To show what I changed in the program I commented the wrong line with ''MahMia'' in front.
The line belowthat is the corrected one marked with       ''WhT

If you find the corrections usefull, you can delete all lines with ''MahMia''

This corrected file is published as:  GHS939-0

Jan [ WhTurner ] The Netherlands

• Marked as answer by Monday, July 23, 2018 3:27 PM
Monday, July 23, 2018 11:58 AM

### All replies

• Hi Mahreen, nice drawing by Turtle with colorful edges and also filled!

Nonki Takahashi

• Marked as answer by Tuesday, July 3, 2018 12:09 PM
Monday, July 2, 2018 10:17 AM
• ZFF937 is a blue car multiple Keyboard and Animation program car with a yellow ellipse has rotating lights. car with yellow rectangle is moving with arrowkeys . car with green ellipse is preforming two events it has blinking Lights and is moving with keys SWAT . I want to move the Keys SWAT event to the car with Green rectangle. the code should work independet of the other codes and should work if put alone or another programm . make it as simple  and easy thankyou                                                                                                                        mahreen miangul

Tuesday, July 3, 2018 12:31 PM
• Hi Mahreen, how about changing lines 67-75 as follows?

```' Car  Reverse Moving  X,Y  Direction
cycleX= shapes.GetLeft(shp[NMB][1])
cycleY= shapes.GetTop(shp[NMB][1])
If cycleX<0 Or cycleX>GraphicsWindow.Width-60 Then
ddx=-ddx
EndIf
If cycleY<20 Or cycleY>GraphicsWindow.Height-80 Then
ddy=-ddy
EndIf```

Nonki Takahashi

Sunday, July 8, 2018 2:48 AM
•  ID QFW203 out skecth of Klassic Soccer Ball now to color it need help                  mahreen miangul
Monday, July 9, 2018 12:52 PM
• ID ZFF937 the yellow rectangle top and the yellow ellipse top are ok now the green ellipse top is performing the blinking
function which is what i want now the car with rectangle green top should prform the moving function key S right W left
key A up movement key T down . the car is not moving with key A and Key T. while the key S and  ket W are working.
A and T are not there are four function and four Cars one car should perform one function Thankyou
mahreen miangul
Monday, July 9, 2018 3:59 PM
• Did you replace the lines 67-75 with the programpart in Nonki's posting of July 8th? Then the car with green ellips (= shape nr 8 ) is responding to SWAT  If you want to move another car, change the number NMB="8:1""  to NMB="x:1", where x is the number of the shape.

Hint: when you change an aircraft to a car, change also in the comments aircraft to car.

Do you need the apples in this program?

Jan [ WhTurner ] The Netherlands

• Marked as answer by Thursday, July 12, 2018 5:16 AM
Monday, July 9, 2018 5:55 PM
• Apples are not needed in the program they are for the background senary but looks nice in the program i have changed my lines with nonkis in  DWT577   but my program is a mess with keys SWAT all not working now. code for apples are applied twice in shapes we can delet on of it if it is efecting the code program we can remove the apples                                                                                                    mahreen miangul
Thursday, July 12, 2018 5:41 AM
• You have to put in line 34 the shapenumber of the car you want to move with SWAT e.g.

NMB="8:1"  '  Aircraft shapes number=5   repeat =1    for the second car from the left,  or  "7:1" for the first car.

Can you describe in words what you want the program to do:

- draw four cars

- put the first car in motion with the keys SWAT

- move the third car by pushing one of the arrow keys

--...   other things you want to do (draw apples...)

It then easier to see what the purpose of different parts of the program should do.

Jan [ WhTurner ] The Netherlands

• Marked as answer by Thursday, July 12, 2018 1:54 PM
Thursday, July 12, 2018 9:49 AM
• GHS939 the blue car is performing two Events Blinkig and moving by keys S-W-A-T. The program has a cannon which is firing when key F is down and moving left right with keys X-Z.the program has thee parts 1-Blinking 2-moving blue car by Keys SWAT 3-(cannon firing by Key F and moving left right by keys X-Z and doing Collison Check).I want to seprate all the three events and program then not to depend on each other.thank you i hope you understood my  problem this time.if it is posible"You  Hit  !!!!!!!!!!!" should appear on the screen with colliso check
mahreen miangul
Monday, July 16, 2018 10:40 AM
• When I ran your program I noticed the collitioncheck didn't work well.
I wrote some experimental programs to try to understand how to detect collisions.
A circle aproaching from the left and a rectangle collide when the left coordinate
of the circle is at a distance of the size of the circle from the left coordinate
of the rectangle (in your program this is 40 pixels). I changed the If statement
in the collition check (line 77) with this correction (left side and top side).

The collition then didn't work right. I found you check the collition of the ball
with the left rear wheel (shape[1][3]) This should be the body of the car (shape[1][5]),
in lines 58 and 59 you calculate cycleX and cycleY from shp[NMB][3], should be [5].
In lines 60 and 63 you use shape[5][3]. As there is no shape[5] this is always zero.
Use shape[1][5].
After testing with these changes there still was something wrong  with the collition
detection. In line 77 the use of shape[1][53]["height"] uses the size of the shape as
defined in the subroutine, but doesn't take the size factor into account, the size
has to be magnified by ss.

I didn't do anything about your other questions, as the above changes has to work first.
To show what I changed in the program I commented the wrong line with ''MahMia'' in front.
The line belowthat is the corrected one marked with       ''WhT

If you find the corrections usefull, you can delete all lines with ''MahMia''

This corrected file is published as:  GHS939-0

Jan [ WhTurner ] The Netherlands

• Marked as answer by Monday, July 23, 2018 3:27 PM
Monday, July 23, 2018 11:58 AM