Drawing a shape at a collision location.
Author |
Message |
Ledrif
|
Posted: Sun Nov 02, 2008 2:40 pm Post subject: Drawing a shape at a collision location. |
|
|
Hello, I am fairly new to programing(about a month), however I have high goals, and want to learn more.
So far the only thing I have made so far was a complex single floor maze game.
So far I know collisions, movements, and drawing comands.
Basic thoughts of arrays, and some random stuff.
As of this moment im making a game on my own time, involving
- A ball the bounces when it hits anything of importance.
- A wall on the sides and top of a 400,400 screen
- A gray box placed on the screen
- A paddle type box that you move
As it stands the background is black, and the gray box is well gray.
what im wanting to code is when the ball collides with the gray box,
I intend on having the program code a black circle at the point of collision that will stay there.
This is because im intending to use whatdotcolour for the collision, and im wanting to simulate destruction of part of the object.
The goal of this is it make the edges of the gray area change in regards to where it was hit before, changing visual shape, and bounce directions.
---------------------------------------------------------------------------
if whatdotcolour(x+6,y)=gray or whatdotcolour(x-6,y)=gray then
Xspeed= -Xpeed
end if
if whatdotcolour(x,y+6)=gray or whatdotcolour(x,y-6)=gray then
Yspeed= -Yspeed
end if
---------------------------------------------------------------------------
what I was thinking was if I can assign the Midpoint location of the ball
at the moment of collision as the midpoint location of the Black stationary circle.
however keep the two variables seperate.
However im not sure if I can assign one variable from the value of a
different changing variable and have them be seperate.
After that issue is solved then il start thinking of ways to be able to make muiltiple black ovals.
Il be starting that thought experimenting with Arrays of values. Then it will be done.
However that questions not as important as the first. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
DemonWasp
|
Posted: Mon Nov 03, 2008 10:40 am Post subject: RE:Drawing a shape at a collision location. |
|
|
Quote: However im not sure if I can assign one variable from the value of a
different changing variable and have them be seperate.
Yes, you can. Even though x = y / 2 looks a whole lot like what you'd see in math class, it's very different in computer programming.
In Math, x = y / 2 means "x is always one-half of y, and will never be anything else"
In Programming, x = y / 2 means "x now has the value of y, divided by 2...when y changes, x does NOT change and vice-versa"
And, as we tell everyone who's new here, please start using tags to make your code more readable. For Turing code, use [ syntax = "Turing " ] [ / syntax ], minus the spaces. |
|
|
|
|
![](images/spacer.gif) |
Ledrif
|
Posted: Mon Nov 03, 2008 4:23 pm Post subject: RE:Drawing a shape at a collision location. |
|
|
Kk, I solved my problem myself after some thought and doublechecking at school today. Like you had said, I was mixing Coding, and Mathamatics.
Now I just need to start troubleshooting my next step, haha.
And thank you for the Tags information. |
|
|
|
|
![](images/spacer.gif) |
|
|