Velocity
Author |
Message |
yumrum
|
Posted: Tue Jun 02, 2009 6:39 pm Post subject: Velocity |
|
|
What is it you are trying to achieve?
add velocity and change in direction smoothly in my game for comp controlled stuff
What is the problem you are having?
Don't really understand velocity
Describe what you have tried to solve this problem
turing helped it
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
SO my tag game very long, Thats the one player just to show but i mostly just need an explanation of velocity
Turing: |
%%%%%%%%%%%
%VARIABLES%
%%%%%%%%%%%
% second screen
var winID : int
% 1 player or two player
var playerinfo : int % if one player of two
% Positions
var x, y, x1, y1, x2, y2, x4, y4, x5, y5, x6, y6, x7, y7, x8, y8 : int % positions
var x9, x10, x11, x12, x13, x14, x15, y9, y10, y11, y12, y13, y14, y15 : int % positions
var x16, x17, x18, y16, y17, y18 : int % positiosn
var a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12, a13, a14, a15, a16, a17, a18 : int % change in direction
var o1, o2, o3, o4, o5, o6, o7, o8, o9, o10 : int := 0
var i1, i2, i3, i4, i5, i6, i7, i8, i9, i10 : int := 0
%Intesity sides
var xsize : int := 1200
var ysize : int := 600
var screen : int := 0
% SKILLS
var p1sk : int := 0
var p2sk : int := 0
%not eliminated to fast
var fastout : int := 0
% Time
var runingtime : real := 0 % runingtime
var T1a, T1b, T2a, T2b : real := 0 % timer for invisibility
var P1it, P2it, starttime : real := 0 % timer for who's it
% REF STUFF
var f, t : int := 1
% People and whose it
var colours, colours2 : int % Colour / if it
var p1 : int := 12 % player 1
var p2 : int := 9 % player 2
var r : int := 1
var z : int := 1
% help with random
var counter : int := 0
var counter2 : int := 0
% Score
var p1s, p2s : int := 0
% what things equal
x := 10
y := 10
x1 := 1190
y1 := 590
colours := p1
colours2 := p2
x2 := 1190
y2 := 10
%Randomize Circle cordonites
var x3, y3 : int
% dotfor amount
var dotfor : int := 5
%LOADING Bar because it's cool
var load : int := 0
% Movement
var move1 : int := 6
var move2 : int := 5
var move3 : int := 5
% play agian
var answer : string
%FONTS
var font1, font2, font3, font4 : int
font1 := Font.New ("sans serif:18:bold")
font2 := Font.New ("sans serif:36:bold")
font3 := Font.New ("mono:20")
font4 := Font.New ("Palatino:40:Bold,Italic")
%pic
%var background : int := Pic.FileNew ("Pic/My Map 1.bmp") % not used at the moment
var Grass : int := Pic.FileNew ("Pic/Grass.bmp")
var page2 : int := Pic.FileNew ("Pic/tag-your-it.bmp")
% Movement
var chars : array char of boolean
% Procedure for movement of player one
procedure Player1move
if chars (KEY_UP_ARROW) and t = 1 then
y := y + 5
end if
if chars (KEY_RIGHT_ARROW) and t = 1 then
x := x + 5
end if
if chars (KEY_LEFT_ARROW) and t = 1 then
x := x - 5
end if
if chars (KEY_DOWN_ARROW) and t = 1 then
y := y - 5
end if
end Player1move
% position of black moving circles
randint (x4, 1, 1199)
randint (y4, 1, 599)
randint (x5, 1, 1199)
randint (y5, 1, 599)
randint (x6, 1, 1199)
randint (y6, 1, 599)
randint (x7, 1, 1199)
randint (y7, 1, 599)
randint (x8, 1, 1199)
randint (y8, 1, 599)
randint (x9, 1, 1199)
randint (y9, 1, 599)
randint (x10, 1, 1199)
randint (y10, 1, 599)
randint (x11, 1, 1199)
randint (y11, 1, 599)
randint (x12, 1, 1199)
randint (y12, 1, 599)
randint (x13, 1, 1199)
randint (y13, 1, 599)
randint (x14, 1, 1199)
randint (y14, 1, 599)
randint (x15, 1, 1199)
randint (y15, 1, 599)
randint (x16, 1, 1199)
randint (y16, 1, 599)
randint (x17, 1, 1199)
randint (y17, 1, 599)
randint (x18, 1, 1199)
randint (y18, 1, 599)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%GAME STARTS %%%%%%%%%% GAMES STARTS %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Opening Screen
Music.PlayFileLoop ("Music/Canon.mp3") % Music
setscreen ("graphics:600;600")
Draw.FillBox (1000, 1000, 0, 0, black)
Draw.Text ("TAG YOU'RE IT", 160, 500, font2, brightred)
Draw.Text ("The goal is to touch the other player", 120, 450, font1, yellow)
Draw.Text ("A,W,S,D controls the green dot", 140, 400, font1, yellow)
Draw.Text ("Arrow Keys control the red dot", 140, 350, font1, yellow)
Draw.Text ("The Game will begin shortly", 155, 300, font1, yellow)
Pic.Draw (page2, 200, 0, picMerge)
delay (5000)
cls
%second screen
Draw.FillBox (1000, 1000, 0, 0, black)
Draw.Text ("O resets the screen", 80, 500, font3, yellow)
Draw.Text (" L and K are for invisiblity for red", 10, 450, font3, yellow)
Draw.Text (" E and Q are for invisiblity for Blue", 5, 400, font3, yellow)
Draw.Text (" Red means you're it", 80, 350, font3, brightgreen)
Draw.Text (" Hit 1 for one player", 80, 300, font3, brightred)
Draw.Text (" Hit 2 for two player", 80, 250, font3, brightred)
get playerinfo % Getting if one player or two
View.Set ("offscreenonly,title:Tag Time,nobuttonbar,graphics:191;35")
loop
load := load + 1
drawfillbox (4 + load, 5, 5, 25, brightred)
exit when load = 191
delay (10)
View.Update
end loop
% Setting Screen size
setscreen ("graphics:1200;600,offscreenonly")
% ONE PLAYER
if playerinfo = 1 then
x := 50
y := 50
starttime := Time.Elapsed
loop
% So not eliminated to quickly
if runingtime - starttime < 5000 then
fastout := 1
else
fastout := 0
end if
% some stuff
colours := 9
counter := counter + 1
cls
%Background
Draw.FillBox (1200, 600, 0, 0, 2)
% circles before 1500
if counter = 200 then
% position of black moving circles
randint (x4, 1, 1199)
randint (y4, 1, 599)
randint (x5, 1, 1199)
randint (y5, 1, 599)
randint (x6, 1, 1199)
randint (y6, 1, 599)
randint (x7, 1, 1199)
randint (y7, 1, 599)
randint (x8, 1, 1199)
randint (y8, 1, 599)
randint (x9, 1, 1199)
randint (y9, 1, 599)
randint (x10, 1, 1199)
randint (y10, 1, 599)
randint (x11, 1, 1199)
randint (y11, 1, 599)
randint (x12, 1, 1199)
randint (y12, 1, 599)
randint (x13, 1, 1199)
randint (y13, 1, 599)
randint (x14, 1, 1199)
randint (y14, 1, 599)
randint (x15, 1, 1199)
randint (y15, 1, 599)
randint (x16, 1, 1199)
randint (y16, 1, 599)
randint (x17, 1, 1199)
randint (y17, 1, 599)
randint (x18, 1, 1199)
randint (y18, 1, 599)
counter2 := 200 + counter2
counter := 0
end if
%AFTER 1500
if counter2 = 1500 or counter2 > 1500 then
Draw.FillOval (o10, i10, 10, 10, black)
Draw.FillOval (o9, i9, 10, 10, black)
Draw.FillOval (o8, i8, 10, 10, black)
Draw.FillOval (o7, i7, 10, 10, black)
Draw.FillOval (o6, i6, 10, 10, black)
Draw.FillOval (o5, i5, 10, 10, black)
Draw.FillOval (o4, i4, 10, 10, black)
Draw.FillOval (o3, i3, 10, 10, black)
Draw.FillOval (o2, i2, 10, 10, black)
Draw.FillOval (o1, i1, 10, 10, black)
if counter = 200 then
% Second set
randint (o1, 1, 1199)
randint (i1, 1, 599)
randint (o2, 1, 1199)
randint (i2, 1, 599)
randint (o3, 1, 1199)
randint (i3, 1, 599)
randint (o4, 1, 1199)
randint (i4, 1, 599)
randint (o5, 1, 1199)
randint (i5, 1, 599)
randint (o6, 1, 1199)
randint (i6, 1, 599)
randint (o7, 1, 1199)
randint (i7, 1, 599)
randint (o8, 1, 1199)
randint (i8, 1, 599)
randint (o9, 1, 1199)
randint (i9, 1, 599)
randint (o10, 1, 1199)
randint (i10, 1, 599)
end if
end if
Input.KeyDown (chars )
%Player 1
Player1move
%Glitch Fix
if chars ('o') then
x := 10
y := 10
end if
% Teleport Secret player 1 top right cornor
if chars ('/') then
x := 10
y := 590
end if
%Sides PLAYER 1
if x = 1200 then
x := 5
end if
if x = 0 then
x := 1195
end if
if y = 600 then
y := 5
end if
if y = 0 then
y := 595
end if
%movement of all Dots
x4 := x4 + move3
y4 := y4 + 0
x5 := x5 + 0
y5 := y5 + move3
x6 := x6 + move3
y6 := y6 + move3
x7 := x7 + move3
y7 := y7 + 0
x8 := x8 + 0
y8 := y8 + move3
x9 := x9 + move3
y9 := y9 + 0
x10 := x10 + 0
y10 := y10 + move3
x11 := x11 + move3
y11 := y11 + move3
x12 := x12 + move3
y12 := y12 + 0
x13 := x13 + 0
y13 := y13 + move3
x14 := x14 + move3
y14 := y14 + 0
x15 := x15 + 0
y15 := y15 + move3
x16 := x16 + move3
y16 := y16 + move3
x17 := x17 + move3
y17 := y17 + 0
x18 := x18 + 0
y18 := y18 + move3
% Movement of the after 1500
o1 := o1 + 0
i1 := i1 + move3
o2 := o2 + move3
i2 := i2 + 0
o3 := o3 + 0
i3 := i3 + move3
o4 := o4 + move3
i4 := i4 + move3
o5 := o5 + move3
i5 := i5 + 0
o6 := o6 + 0
i6 := i6 + move3
o7 := o7 + move3
i7 := i7 + 0
o8 := o8 + 0
i8 := i8 + move3
o9 := o9 + move3
i9 := i9 + move3
o10 := o10 + move3
i10 := i10 + 0
%Counter to increase speed
if counter2 = 200 then
move3 := 6
end if
if counter2 = 400 then
move3 := 7
end if
if counter2 = 800 then
move3 := 8
end if
if counter2 > 1000 then
move3 := 9
%DRAW RED DOTS
Draw.FillOval (o10, i10, 10, 10, brightred)
Draw.FillOval (o9, i9, 10, 10, brightred)
Draw.FillOval (o8, i8, 10, 10, brightred)
Draw.FillOval (o7, i7, 10, 10, brightred)
Draw.FillOval (o6, i6, 10, 10, brightred)
Draw.FillOval (o5, i5, 10, 10, brightred)
Draw.FillOval (o4, i4, 10, 10, brightred)
Draw.FillOval (o3, i3, 10, 10, brightred)
Draw.FillOval (o2, i2, 10, 10, brightred)
Draw.FillOval (o1, i1, 10, 10, brightred)
end if
% touches side for black circles
if x4 > 1200 then
x4 := 5
end if
if x4 < 0 then
x4 := 1195
end if
if y4 > 600 then
y4 := 5
end if
if y4 < 0 then
y4 := 595
end if
if x5 > 1200 then
x5 := 5
end if
if x5 < 0 then
x5 := 1195
end if
if y5 > 600 then
y5 := 5
end if
if y5 < 0 then
y5 := 595
end if
if x6 > 1200 then
x6 := 5
end if
if x6 < 0 then
x6 := 1195
end if
if y6 > 600 then
y6 := 5
end if
if y6 < 0 then
y6 := 595
end if
if x7 > 1200 then
x7 := 5
end if
if x7 < 0 then
x7 := 1195
end if
if y7 > 600 then
y7 := 5
end if
if y7 < 0 then
y7 := 595
end if
if x8 > 1200 then
x8 := 5
end if
if x8 < 0 then
x8 := 1195
end if
if y8 > 600 then
y8 := 5
end if
if y8 < 0 then
y8 := 595
end if
if x9 > 1200 then
x9 := 5
end if
if x9 < 0 then
x9 := 1195
end if
if y9 > 600 then
y9 := 5
end if
if y9 < 0 then
y9 := 595
end if
if x10 > 1200 then
x10 := 5
end if
if x10 < 0 then
x10 := 1195
end if
if y10 > 600 then
y10 := 5
end if
if y10 < 0 then
y10 := 595
end if
if x11 > 1200 then
x11 := 5
end if
if x11 < 0 then
x11 := 1195
end if
if y11 > 600 then
y11 := 5
end if
if y11 < 0 then
y11 := 595
end if
if x12 > 1200 then
x12 := 5
end if
if x12 < 0 then
x12 := 1195
end if
if y12 > 600 then
y12 := 5
end if
if y12 < 0 then
y12 := 595
end if
if x13 > 1200 then
x13 := 5
end if
if x13 < 0 then
x13 := 1195
end if
if y13 > 600 then
y13 := 5
end if
if y13 < 0 then
y13 := 595
end if
if x14 > 1200 then
x14 := 5
end if
if x14 < 0 then
x14 := 1195
end if
if y14 > 600 then
y14 := 5
end if
if y14 < 0 then
y14 := 595
end if
if x15 > 1200 then
x15 := 5
end if
if x15 < 0 then
x15 := 1195
end if
if y15 > 600 then
y15 := 5
end if
if y15 < 0 then
y15 := 595
end if
if x16 > 1200 then
x16 := 5
end if
if x16 < 0 then
x16 := 1195
end if
if y16 > 600 then
y16 := 5
end if
if y16 < 0 then
y16 := 595
end if
if x17 > 1200 then
x17 := 5
end if
if x17 < 0 then
x17 := 1195
end if
if y17 > 600 then
y17 := 5
end if
if y17 < 0 then
y17 := 595
end if
if x18 > 1200 then
x18 := 5
end if
if x18 < 0 then
x18 := 1195
end if
if y18 > 600 then
y18 := 5
end if
if y18 < 0 then
y18 := 595
end if
% RED Cirlces Wall
if o1 > 1200 then
o1 := 5
end if
if o1 < 0 then
o1 := 1195
end if
if i1 > 600 then
i1 := 5
end if
if i1 < 0 then
i1 := 595
end if
if o2 > 1200 then
o2 := 5
end if
if o2 < 0 then
o2 := 1195
end if
if i2 > 600 then
i2 := 5
end if
if i2 < 0 then
i2 := 595
end if
if o3 > 1200 then
o3 := 5
end if
if o3 < 0 then
o3 := 1195
end if
if i3 > 600 then
i3 := 5
end if
if i3 < 0 then
i3 := 595
end if
if o4 > 1200 then
o4 := 5
end if
if o4 < 0 then
o4 := 1195
end if
if i4 > 600 then
i4 := 5
end if
if i4 < 0 then
i4 := 595
end if
if o5 > 1200 then
o5 := 5
end if
if o5 < 0 then
o5 := 1195
end if
if i5 > 600 then
i5 := 5
end if
if i5 < 0 then
i5 := 595
end if
if o6 > 1200 then
o6 := 5
end if
if o6 < 0 then
o6 := 1195
end if
if i6 > 600 then
i6 := 5
end if
if i6 < 0 then
i6 := 595
end if
if o7 > 1200 then
o7 := 5
end if
if o7 < 0 then
o7 := 1195
end if
if i7 > 600 then
i7 := 5
end if
if i7 < 0 then
i7 := 595
end if
if o8 > 1200 then
o8 := 5
end if
if o8 < 0 then
o8 := 1195
end if
if i8 > 600 then
i8 := 5
end if
if i8 < 0 then
i8 := 595
end if
if o9 > 1200 then
o9 := 5
end if
if o9 < 0 then
o9 := 1195
end if
if i9 > 600 then
i9 := 5
end if
if i9 < 0 then
i9 := 595
end if
if o10 > 1200 then
o10 := 5
end if
if o10 < 0 then
o10 := 1195
end if
if i10 > 600 then
i10 := 5
end if
if i10 < 0 then
i10 := 595
end if
%If Touch
if x < x4 + 10 and x > x4 - 10 and y < y4 + 10 and y > y4 - 10 and fastout = 0
then
cls
exit
end if
if x < x5 + 10 and x > x5 - 10 and y < y5 + 10 and y > y5 - 10 and fastout = 0
then
cls
exit
end if
if x < x6 + 10 and x > x6 - 10 and y < y6 + 10 and y > y6 - 10 and fastout = 0
then
cls
exit
end if
if x < x7 + 10 and x > x7 - 10 and y < y7 + 10 and y > y7 - 10 and fastout = 0
then
cls
exit
end if
if x < x8 + 10 and x > x8 - 10 and y < y8 + 10 and y > y8 - 10 and fastout = 0
then
cls
exit
end if
if x < x9 + 10 and x > x9 - 10 and y < y9 + 10 and y > y9 - 10 and fastout = 0
then
cls
exit
end if
if x < x10 + 10 and x > x10 - 10 and y < y10 + 10 and y > y10 - 10 and fastout = 0
then
cls
exit
end if
if x < x11 + 10 and x > x11 - 10 and y < y11 + 10 and y > y11 - 10 and fastout = 0
then
cls
exit
end if
if x < x12 + 10 and x > x12 - 10 and y < y12 + 10 and y > y12 - 10 and fastout = 0
then
cls
exit
end if
if x < x13 + 10 and x > x13 - 10 and y < y13 + 10 and y > y13 - 10 and fastout = 0
then
cls
exit
end if
if x < x14 + 10 and x > x14 - 10 and y < y14 + 10 and y > y14 - 10 and fastout = 0
then
cls
exit
end if
if x < x15 + 10 and x > x15 - 10 and y < y15 + 10 and y > y15 - 10 and fastout = 0
then
cls
exit
end if
if x < x16 + 10 and x > x16 - 10 and y < y16 + 10 and y > y16 - 10 and fastout = 0
then
cls
exit
end if
if x < x17 + 10 and x > x17 - 10 and y < y17 + 10 and y > y17 - 10 and fastout = 0
then
cls
exit
end if
if x < x18 + 10 and x > x18 - 10 and y < y18 + 10 and y > y18 - 10 and fastout = 0
then
cls
exit
end if
if x < o1 + 10 and x > o1 - 10 and y < i1 + 10 and y > i1 - 10 and fastout = 0
then
cls
exit
end if
if x < o2 + 10 and x > o2 - 10 and y < i2 + 10 and y > i2 - 10 and fastout = 0
then
cls
exit
end if
if x < o3 + 10 and x > o3 - 10 and y < i3 + 10 and y > i3 - 10 and fastout = 0
then
cls
exit
end if
if x < o4 + 10 and x > o4 - 10 and y < i4 + 10 and y > i4 - 10 and fastout = 0
then
cls
exit
end if
if x < o5 + 10 and x > o5 - 10 and y < i5 + 10 and y > i5 - 10 and fastout = 0
then
cls
exit
end if
if x < o6 + 10 and x > o6 - 10 and y < i6 + 10 and y > i6 - 10 and fastout = 0
then
cls
exit
end if
if x < o7 + 10 and x > o7 - 10 and y < i7 + 10 and y > i7 - 10 and fastout = 0
then
cls
exit
end if
if x < o8 + 10 and x > o8 - 10 and y < i8 + 10 and y > i8 - 10 and fastout = 0
then
cls
exit
end if
if x < o9 + 10 and x > o9 - 10 and y < i9 + 10 and y > i9 - 10 and fastout = 0
then
cls
exit
end if
if x < o10 + 10 and x > o10 - 10 and y < i10 + 10 and y > i10 - 10 and fastout = 0
then
cls
exit
end if
% Draw black dots
Draw.FillOval (x18, y18, 10, 10, black)
Draw.FillOval (x17, y17, 10, 10, black)
Draw.FillOval (x16, y16, 10, 10, black)
Draw.FillOval (x15, y15, 10, 10, black)
Draw.FillOval (x14, y14, 10, 10, black)
Draw.FillOval (x13, y13, 10, 10, black)
Draw.FillOval (x12, y12, 10, 10, black)
Draw.FillOval (x11, y11, 10, 10, black)
Draw.FillOval (x10, y10, 10, 10, black)
Draw.FillOval (x9, y9, 10, 10, black)
Draw.FillOval (x8, y8, 10, 10, black)
Draw.FillOval (x7, y7, 10, 10, black)
Draw.FillOval (x6, y6, 10, 10, black)
Draw.FillOval (x5, y5, 10, 10, black)
Draw.FillOval (x4, y4, 10, 10, black)
%Draw Person
Draw.FillOval (x, y, 10, 10, colours )
View.Update
delay (15)
runingtime := Time.Elapsed
if runingtime > 500000 then
put "hit y to play again. and n to stop"
get answer
if answer = "y" then
end if
if answer = "n" then
exit
end if
end if
end loop
% GAME OVER
cls
View.Update
if runingtime > 500000 then
put "You Came, You tried, You DOMINATED. INCREDABLE you lasted 5 mins"
View.Update
elsif counter2 < 300 then
put "Good Effort, You came, You tried and You lasted to ", counter2 + counter, " counts"
View.Update
end if
if counter2 > 301 then
put "Very Good, You Lasted to ", counter2 + counter, " counts"
View.Update
end if
end if
|
Please specify what version of Turing you are using
<Answer Here> |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 7:29 pm Post subject: Re: Velocity |
|
|
Velocities are the same thing as adding something say x+=10, but replace the 10 with a variable, x+= vel_x
You're going to need a few variables for velocity.
The highest velocity the object can achieve(you dont want your circles going light-speed)
The actual velocity of the object
(optional) the increment of velocity
You will also need to "decay" the velocity so if it isnt gaining velocity it is losing it, just like a regular object.
Now replace the part of code where if the key is pressed, your circle gains +x position but the x velocity is increased. The velocity needs to be constantly added for this to work(or added only if the velocity is ~= 0)
In result, you will get something like this
If key(right arrow) then
vel_x+=vel_increment%The increase in velocity, can be 1 or 2 or 3... etc
%Repeat this process for all 4 directions.
if vel_x > vel_xmax then
vel_x = vel_xmax
%Same for y axis
%Decaying velocities
vel_x -=1
vel_y -=1
before your end loop,
x+=vel_x
y+=vel_y
[/list] |
|
|
|
|
![](images/spacer.gif) |
tjmoore1993
![](http://compsci.ca/v3/uploads/user_avatars/8387623034a0f8ae34317b.gif)
|
Posted: Tue Jun 02, 2009 7:47 pm Post subject: RE:Velocity |
|
|
Diablo normally when your dealing with velocity your can do it like this.
Turing: |
const Gravity := 3 % we would have gravity ;)
var vel_y := 0
loop
if character jumps...
vel_y += 20
end if
vel_y -= Gravity
y += cVelocity
if y <= ground then
y := ground
end if
end loop
% This is not real Turing coding, It is meant for you to get the idea.
|
Poor demonstration but basically with an addition of gravity you can get some good results |
|
|
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 8:58 pm Post subject: Re: Velocity |
|
|
You're using it for jumps, in his game, there is no "up" so I was using decay to show an example. In what I described, the vel_x and vel_y decays are the same as your gravity. But yeah, that is what I did for a side-scroller game I did a while back. |
|
|
|
|
![](images/spacer.gif) |
yumrum
|
Posted: Tue Jun 02, 2009 9:42 pm Post subject: RE:Velocity |
|
|
alright that makes some sense but the velocity is for the computer controled stuff |
|
|
|
|
![](images/spacer.gif) |
Diablo117
![](http://compsci.ca/v3/uploads/user_avatars/6345067144872e0c7b2cf1.jpg)
|
Posted: Tue Jun 02, 2009 10:27 pm Post subject: Re: Velocity |
|
|
Put your enemies in an array and use a for loop to increase their velocity |
|
|
|
|
![](images/spacer.gif) |
isaiahk9
![](http://compsci.ca/v3/uploads/user_avatars/1465120414488e669e1f83a.jpg)
|
Posted: Wed Jun 03, 2009 2:32 pm Post subject: RE:Velocity |
|
|
@yumrum : Learn how to use arrays and you'll cut the code length down to about 20% or less. |
|
|
|
|
![](images/spacer.gif) |
yumrum
|
Posted: Wed Jun 03, 2009 2:41 pm Post subject: RE:Velocity |
|
|
will try in my next game I'm done with that. gonna make Square soccer... |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
tjmoore1993
![](http://compsci.ca/v3/uploads/user_avatars/8387623034a0f8ae34317b.gif)
|
Posted: Wed Jun 03, 2009 2:45 pm Post subject: Re: RE:Velocity |
|
|
isaiahk9 @ Wed Jun 03, 2009 2:32 pm wrote: @yumrum : Learn how to use arrays and you'll cut the code length down to about 20% or less.
Decreasing the amount of variables needed can increase the speed of the game and would probably be safer for our eyes to look at . |
|
|
|
|
![](images/spacer.gif) |
yumrum
|
Posted: Wed Jun 03, 2009 3:18 pm Post subject: RE:Velocity |
|
|
ya but i tried them and it didn't work so i'm not sure how to use them |
|
|
|
|
![](images/spacer.gif) |
|
|