WhatDotColor Problems
Author |
Message |
X2_star
|
Posted: Wed Mar 11, 2009 7:12 pm Post subject: WhatDotColor Problems |
|
|
Hello, I have read all the tutorials I could find about whatdotcolor to try to solve my problem. I may be missing something simple but I want my character to stop when he hits the walls but after hours of trying iI made it worse because now my character wont move. Any help would be appreciated.
Description: |
|
 Download |
Filename: |
Gamepeice Movement.t |
Filesize: |
6.34 KB |
Downloaded: |
59 Time(s) |
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
Insectoid

|
Posted: Wed Mar 11, 2009 7:16 pm Post subject: RE:WhatDotColor Problems |
|
|
For anyone too lazy to download it,
Turing: |
%********************************
%name block ICS 3M ICS 3M ICS 3M ICS 3M
%name - Justyn Capeling
%date - March 11/2009
%program description - Keystroke Game
%*********************************
%
%
%*********************************
%Algorithm
%A set of instructions in order, used to pre-plan a program
%**************************THESE ARE THE MOST IMPORTANT STEPS FOR KEYSTROKE********************
%DRAWGAME PIECE WITH PARAMETERS
%CAPTURE GAME PEICE WITH PIC.NEW AND PCID
%DRAW BACKGORUND WIHTOUT PARAMETERS
%SET UP INFINITE LOOP FOR MULTIPLE KEYSTROKE USING LOOP END LOOP
%USE DRAW DELAY COVER CONCEPT WHERE DRAW IS PIC.DRAW FOR GAMEPIECE AND COVER IS PIC.DRAW
%DETERMINE KEYSTROKE ARROWS USING INPUT.KEYDOWN
%CHECK KEYSTROKE USING IF COMMAND
% ADD VALUES TO X OR Y CORDINIATE USING X:=X+5 OR Y:=Y+5 WHICJ IS CALLED SUMMATION
% CHECK BOUNDRIES/SCREEN EDGE USING IF X
%*********************************
%
%
%*********************************
%Variables Dictionary
%declare variable by name and type
var picID : int %....................represents the gamepiece in memory
var chars : array char of boolean %..sets aside memory for keystroke
var i : int
var l : int := 0
var t : int := 0
var x, y : int
var x1, y1 : int
var posx, posy : int
var velx, vely : int
var show : boolean := true
x := 520
y := - 10
x1 := 100
y1 := 100
%*********************************
%
%
%*********************************
%Procedures/Subprograms/Subroutines
%do each seperatly in a block
proc GAMEPIECE (var x : int, var y : int)
drawfilloval (50 + x, 53 + y, 7, 7, 66) %....................................Head
drawfillbox (45 + x, 45 + y, 55 + x, 25 + y, 42) %...........................Body
drawfillbox (43 + x, 55 + y, 57 + x, 60 + y, 42) %...........................Hat
drawfillbox (38 + x, 55 + y, 43 + x, 57 + y, 42) %...........................Hat Lid
drawfilloval (46 + x, 52 + y, 1, 1, black) %.................................Eye
drawline (45 + x, 49 + y, 49 + x, 49 + y, black) %...........................Mouth
Draw.ThickLine (48 + x, 25 + y, 46 + x, 15 + y, 6, 42) %.....................Left Leg
Draw.ThickLine (52 + x, 25 + y, 54 + x, 15 + y, 6, 42) %.....................Right Leg
Draw.ThickLine (50 + x, 40 + y, 36 + x, 38 + y, 4, 42) %.....................Arm
drawfillbox (45 + x, 30 + y, 55 + x, 28 + y, black) %........................Belt
Draw.ThickLine (45 + x, 45 + y, 15 + x, 45 + y, 3, 20) %.....................Gun
Draw.ThickLine (30 + x, 43 + y, 43 + x, 43 + y, 3, 138) % ...................Handle
Draw.ThickLine (36 + x, 40 + y, 42 + x, 40 + y, 4, 138) %
end GAMEPIECE
proc GAMEPIECE1 (var x1 : int, var y1 : int)
drawfilloval (50 + x1, 53 + y1, 7, 7, 66) %..................................Head
drawfillbox (45 + x1, 45 + y1, 55 + x1, 25 + y1, 42) %.......................Body
drawfillbox (43 + x1, 55 + y1, 57 + x1, 60 + y1, 42) %.......................Hat
drawfillbox (55 + x1, 55 + y1, 65 + x1, 57 + y1, 42) %.......................Hat Lid
drawfilloval (54 + x1, 52 + y1, 1, 1, black) %...............................Eye
drawline (52 + x1, 49 + y1, 55 + x1, 49 + y1, black) %.......................Mouth
Draw.ThickLine (48 + x1, 25 + y1, 46 + x1, 15 + y1, 6, 42) %.................Left Leg
Draw.ThickLine (52 + x1, 25 + y1, 54 + x1, 15 + y1, 6, 42) %.................Right Leg
Draw.ThickLine (55 + x1, 40 + y1, 64 + x1, 38 + y1, 4, 42) %.................Arm
drawfillbox (45 + x1, 30 + y1, 55 + x1, 28 + y1, black) %....................Belt
Draw.ThickLine (58 + x1, 43 + y1, 75 + x1, 43 + y1, 3, 20) %.................Gun
Draw.ThickLine (57 + x1, 42 + y1, 68 + x1, 42 + y1, 3, 138) % ...............Handle
Draw.ThickLine (57 + x1, 40 + y1, 67 + x1, 40 + y1, 4, 138) %................Trigger
end GAMEPIECE1
proc BACKGROUNDLVL1
drawfillbox (0, 0, maxx, maxy, 29) %.........................................LEVEL 1 GRAY BACKGROUND
drawfillbox (0, 65, 50, 55, 22)
drawfillbox (100, 55, maxx, 65, 22)
drawfillbox (0, 130, 450, 140, 22)
drawfillbox (550, 130, maxx, 140, 22)
drawfillbox (0, 205, 50, 215, 22)
drawfillbox (150, 205, maxx, 215, 22)
drawfillbox (0, 270, maxx - 100, 280, 22)
drawfillbox (maxx, 340, 200, 350, 22)
end BACKGROUNDLVL1
proc BACKGROUND1
drawfillbox (1, 1, maxx, maxy, green) %.................................Grass
drawfillbox (50, 50, maxx - 55, maxy - 55, darkgray) %..................Main Building
drawfillbox (25, 25, 125, 125, darkgray) %..............................Bottom left corner
drawfillbox (maxx - 30, 25, maxx - 130, 125, darkgray) %....................Bottom Right corner
drawfillbox (25, maxy - 30, 125, maxy - 130, darkgray) %....................Top left corner
drawfillbox (maxx - 30, maxy - 30, maxx - 130, maxy - 130, darkgray) %......Top
end BACKGROUND1
%*********************************
%
%
%*********************************
%Mainline
%step by step enter the program
View.Set ("graphics,offscreenonly")
cls
loop
Input.KeyDown (chars )
if chars (KEY_UP_ARROW) and whatdotcolor (x, y + 10) = 29 then
y := + 5
end if
if chars (KEY_RIGHT_ARROW) and whatdotcolor (x + 11, y ) = 29 then
x := + 5
show := false
end if
if chars (KEY_LEFT_ARROW) and whatdotcolor (x - 11, y ) = 29 then
x := - 5
end if
if chars (KEY_DOWN_ARROW) and whatdotcolor (x, y - 11) = 29 then
y := - 5
end if
if chars (KEY_ENTER ) then
BACKGROUNDLVL1
t := x + 50
l := y
end if
if x < - 35 %...........................................................LEFT BOUNDARY
then
x := x + 5
end if
if x > 580 %...........................................................RIGHT BOUNDARY
then
x := x - 5
end if
if y > 420 %..............................................................TOP BOUNDARY
then
y := y - 5
end if
if y < - 10 %...........................................................BOTTOM BOUNDARY
then
y := y + 5
end if
BACKGROUNDLVL1
GAMEPIECE (x, y )
drawoval (t - 40, l + 44, 2, 1, black)
if t > 0 and t < maxx then
t - = 5
end if
locate (20, 20)
put x : 5, y : 5
View.UpdateArea (0, 0, maxx, maxy)
delay (10)
cls
end loop
%*********************************
|
|
|
|
|
|
 |
Insectoid

|
Posted: Wed Mar 11, 2009 7:24 pm Post subject: RE:WhatDotColor Problems |
|
|
change the
x := x + 5
to
x := -35
and the same with all the other collision detection bits (with the other values, of course)
|
|
|
|
|
 |
X2_star
|
Posted: Wed Mar 11, 2009 7:33 pm Post subject: RE:WhatDotColor Problems |
|
|
I tryed your suggetion but the charcter still wont move.
|
|
|
|
|
 |
Ambiguities
|
Posted: Wed Mar 11, 2009 7:41 pm Post subject: Re: WhatDotColor Problems |
|
|
nice design i wish i was familiar with collision detection. my first game it was all if statements
|
|
|
|
|
 |
corriep
|
Posted: Wed Mar 11, 2009 8:51 pm Post subject: Re: WhatDotColor Problems |
|
|
ok first of y = -10 right off the bat, this means that the y value is off the screen. For quick reference try adding
right before View.UpdateArea. This will draw a dot where the program is checking if it can go up, right, left and down respectively. Where are the dots? Can you see them?
Reply soon and we will help you through it and point ya in the right direction.
|
|
|
|
|
 |
X2_star
|
Posted: Thu Mar 12, 2009 3:53 pm Post subject: RE:WhatDotColor Problems |
|
|
Yeah, I can see the dots. They are at the very bottom of the screen at the far left of my character.
|
|
|
|
|
 |
corriep
|
Posted: Thu Mar 12, 2009 4:39 pm Post subject: Re: WhatDotColor Problems |
|
|
Good, there should be four dots on the top, bottom, left and right of the character to show where whatdotcolor is checking. If the dots are not above, below, left and right of the character than you have a problem and what dot color is not checking the right area.
Try moving around the drawdot co-ordinates while changeing the whatdotcolor co-ordinates. If you get them on the coresponding sides of the character everything should work!
Heres a little hint to get ya started,
Good luck and tell us how it goes!
|
|
|
|
|
 |
Sponsor Sponsor

|
|
 |
|
|