making an oval bounce to continue
Author |
Message |
Velocity
|
Posted: Fri Nov 18, 2011 10:50 am Post subject: making an oval bounce to continue |
|
|
so what i want is to draw an oval on the screen and use the arrow keys and when the player moves the oval to a certain point on the screen, it will continue to the next screen. and ideas on how to do this? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zren
|
Posted: Fri Nov 18, 2011 12:44 pm Post subject: RE:making an oval bounce to continue |
|
|
So like Zelda (Gameboy)?
Goal 1:
Store which zone you are in. Focus on just left/right zone movemend (1 Dimensional). Start at Zone(0).
Write the current zone to screen.
Moving the player past the right of the screen (x > maxx) would go to Zone(+1). The player would be put at (y, 0), wrapping the player to the left side of the screen.
Moving the player past the left of the screen (x < 0) would go to Zone(-1). The player would be put at (y, maxx), wrapping the player to the right side of the screen.
Goal 2:
Create a variable to store a different color for each zone. The color should be used to set the background color.
Limit to only moving to zones that have a background color set.
Prevent the player from going offscreen when he hits the last zone (or going backwards on the first zone).
Further:
From this, you could elaborate on loading a more complex datatype than a background color. Maybe a list of platforms, a grid of tiles...
You could even change the whole logic of 'go offscreen to move to the next zone' to 'find and enter teleporter'. |
|
|
|
|
|
Aange10
|
Posted: Fri Nov 18, 2011 5:53 pm Post subject: RE:making an oval bounce to continue |
|
|
Aange10 wrote: Velocity: This is exactly why you should fill out the pre-formatted post completely, instead of erasing it all.
That never stopped applying. This is the last time I'm going to answer one of you're threads that doesn't tell me what you've tried, and given me an example coding.
Anyways, lets break down you're question! (Hmm, maybe you should try this..)
Velocity wrote:
so what i want is to draw an oval on the screen and use the arrow keys and when the player moves the oval to a certain point on the screen, it will continue to the next screen. and ideas on how to do this?
----
so what I want is to draw an oval on the screen
Firstly, we'll want to make a few variables to represent the dimensions of the oval, and then we draw it. All very basic;
Turing: |
% Oval x/y position, and x/y radius
var oval_x, oval_y, oval_xr, oval_yr : int
% Define variables
oval_x := 100
oval_y := 100
oval_xr := 15
oval_yr := 15
drawfilloval (oval_x, oval_y, oval_xr, oval_yr, black)
|
and use the arrow keys and when the player moves the oval
Okay, if you've read the Turing Walkthrough, you'd have found a link in there telling you about Input.Keydown. Given that there is precise documentation on it, I'm not going to explain how to do it. Only the gist of the program.
Turing: |
% Get input from keyboard
% Make something happen when you get input
% For instance:
if character (KEY_LEFT_ARROW) = true then
oval_x + = 1
end if
|
to a certain point on the screen,
All you have to do is tell the computer what this point(s) is.
it will continue to the next screen.
What is the next screen? There is no next screen. It's all one screen. I know what you're saying; "Aange you're crazy! Of course there is 'Next' screen!". But, no. It's all one screen.
The only thing that changes is what is drawn. What calulations are used.
Turing: |
if level = 1 then
loop
% Do the coding for level one
% When the ball is = [a point] then level := 2
exit when level = 2
end loop
elsif level = 2 then
.
.
.
elsif level = . . .
|
and ideas on how to do this?
It should be you're job to think of ideas, try them, and come ask us why they don't work. You shouldn't ask us for ideas, you should ask why yours aren't working. |
|
|
|
|
|
|
|