move with background
Author |
Message |
gan gar
|
Posted: Sun Dec 13, 2009 1:45 am Post subject: move with background |
|
|
What is it you are trying to achieve?
I am tring have doors that when my guy lands on the open the level.
What is the problem you are having?
when the world opens mu guy shows up and not the door.
Describe what you have tried to solve this problem
everything
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
here is the code i have to pages.
Turing: |
% move char code
var nickstand: int
var x : int := 100
var y : int := 100
var x_velocity : int := 0
var y_velocity : int := 0
var keys : array char of boolean
nickstand := Pic.FileNew ("nickstand.jpg")
View.Set ("offscreenonly")
const Gravity := 2
loop
Input.KeyDown (keys )
if keys (KEY_UP_ARROW) and y <= 0 then
y_velocity := 30 %If the jump button is pressed, velocity shoots up.
end if
if keys (KEY_LEFT_ARROW) and x > 0 then
x - = 5 %basic X movement.
end if
if keys (KEY_RIGHT_ARROW) and x < maxx then
x + = 5
end if
y_velocity - = Gravity %Here, we subtract gravity from velocity.
y + = y_velocity %We've seen this before! Adding velocity to coordinates
if y < 0 then %this makes sure the character stays above the ground (if he goes undr, it brings him back up)
y := 0
y_velocity := 0
end if
Pic.Draw (nickstand, x, y, picCopy)
View.Update
delay (20)
cls
end loop
|
Turing: |
%world 1
setscreen ("graphics")
cls % clears the screen
include "char.t" %adds char to the game.
Pic.ScreenLoad ("world2/level 1.jpg", x, y, picXor) %start world 1 background
|
Please specify what version of Turing you are using
newest (4.1.1)
Description: |
|
Filesize: |
5.04 KB |
Viewed: |
1366 Time(s) |
|
Description: |
|
Filesize: |
813 Bytes |
Viewed: |
1366 Time(s) |
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
mirhagk
|
Posted: Sun Dec 13, 2009 10:06 am Post subject: RE:move with background |
|
|
lol when you copy and paste someone's code from here you should at least change it around a little (i remember reading that tutorial last year lol)
|
|
|
|
|
|
Insectoid
|
Posted: Sun Dec 13, 2009 4:58 pm Post subject: RE:move with background |
|
|
Well, first of all, copying someone else's code without giving proper credit is called plagiarism and that is not supported here. Second, having 2 separate pieces of code does nothing until you combine them in a way that makes sense, which is usually very hard until you understand the code you're stealing.
|
|
|
|
|
|
gan gar
|
Posted: Mon Dec 14, 2009 10:10 am Post subject: RE:move with background |
|
|
ok nvm
|
|
|
|
|
|
mirhagk
|
Posted: Mon Dec 14, 2009 10:52 am Post subject: RE:move with background |
|
|
i mean feel free to use tutorials to your full advantage, but don't copy and paste the whole code. Make sure you understand it all (what if your teacher said "how did you do that?" when all you did was copy and paste you wouldn't be able to answer him/her)
|
|
|
|
|
|
|
|