
-----------------------------------
Boiq
Fri Sep 05, 2008 10:45 am

Wall Help
-----------------------------------
Okay, i'm currently working on a game programmed by Turing. 

I recently added some basic graphic walls using 'drawfillbox'. I have an animated object that is being controll, so how would I make it so when it runs into the wall it stops rather then going through it.

All help would be appreciated to guide me onto the right path, thanks.

-----------------------------------
Tony
Fri Sep 05, 2008 11:11 am

RE:Wall Help
-----------------------------------
Figure out where the wall is.

once than having to hard-code every block location (that gets messy).

http://compsci.ca/blog/wp-content/uploads/2007/10/circle_collision_detection.png
(not really a wall, but it's semi-relevant)

-----------------------------------
Insectoid
Fri Sep 05, 2008 12:46 pm

RE:Wall Help
-----------------------------------
Sorry, tony, I know you love paper and math, but I can't help but give a link of my own.

[url=http://compsci.ca/v3/viewtopic.php?t=18876]Tutorial!

-----------------------------------
S_Grimm
Mon Sep 08, 2008 10:36 am

RE:Wall Help
-----------------------------------
if y location of box is greater than y location of top wall, then y := y -1

-----------------------------------
Warchamp7
Mon Sep 08, 2008 11:02 am

Re: RE:Wall Help
-----------------------------------
if y location of box is greater than y location of top wall, then y := y -1

1. He's talking about blocks not a roof

2. That wouldn't work if he moves more than 1 pixel every loop which is likely unless that loop is 1


Collisions in turing are not a simple task if you're still getting your bearings. You'll need to have collision checks between the object you control and anything that can restrict it's movement. Now if you only had two objects it's not too difficult but with more it becomes a little more daunting. 

Unless you know how to use arrays effectively it won't be fun tracking multiple collisions : /

-----------------------------------
Boiq
Mon Sep 08, 2008 11:06 am

RE:Wall Help
-----------------------------------
Okay, i'm starting to understand a bit.

And yes i'm talking about a collosion with the walls. Isn't it kinda binary, like 0's for path, 1's for walls, 2 for your character, etc?

-----------------------------------
Warchamp7
Mon Sep 08, 2008 11:07 am

RE:Wall Help
-----------------------------------
If you used a tile system yes

-----------------------------------
S_Grimm
Mon Sep 08, 2008 11:43 am

Re: Wall Help
-----------------------------------
This is whant you want to do right?
sorry asbout the rough code. I need to fix the top and right boundries



var x, y : int := 30 %starting position of box
var x1, y1 : int := 40
var move := 5 %change this variable to change movement
var key : array char of boolean
procedure bound
    if (x >= 300) then
        x := x - move
        x1 := x1 - move
    end if
    if x = 300) then
        y := y - move
        y1 := y1 - move
    end if
    if y = 50 not =50. 

Newest Code

if x1 +20 >= 50 and x1 +20 