----------------------------------- kiddcamel Fri Jan 11, 2019 11:16 am Character collision detection in Turing ----------------------------------- I'm trying to program a game for my summative, but I don't really get Turing so any help would be appreciated. Anyways, I have made a circle move, and I can't figure out how to display a death screen when it collides with the green rectangle. Also, our teacher prefers if statements rather than the assert command but if not that's fine. %Global variables import GUI var characterColour: int var font4 : int var font3 : int var chars : array char of boolean var x : int := 5 var y : real := 5 var startButton : int := GUI.CreateButton (maxx div 2, maxy div 2, 0, "start", GUI.Quit) %Main Code %MAIN MENU font4 := Font.New ("Palatino:24:Bold,Italic") font3 := Font.New ("Palatino:12:Bold,Italic") %Title Font.Draw ("DEATH RUN", 250, maxx div 2, font4, red) Font.Draw ("how long will you survive?", 240, 300, font3, red) loop exit when GUI.ProcessEvent end loop cls %LEVEL 1 %Ball Movement proc jump for angle : 0 .. 180 by 5 Input.KeyDown (chars) if chars (KEY_RIGHT_ARROW) then x += 2 end if if chars (KEY_LEFT_ARROW) then x -= 2 end if y := 5 y += 140 * sind (angle) drawfilloval (x, round (y), 5, 5, red) View.Update delay (25) drawfilloval (x, round (y), 5, 5, colorbg) end for end jump loop Input.KeyDown (chars) if chars (KEY_UP_ARROW) then jump end if if chars (KEY_RIGHT_ARROW) then x += 2 end if if chars (KEY_LEFT_ARROW) then x -= 2 end if if x = 80 then put "You lost." end if drawfilloval (x, round (y), 5, 5, red) View.Update delay (10) drawfilloval (x, round (y), 5, 5, colorbg) Draw.FillBox (80, 40, 100, 0, 2) It would mean a lot for any input. :) ----------------------------------- Insectoid Sat Jan 12, 2019 9:02 am RE:Character collision detection in Turing ----------------------------------- The Turing Walkthrough has a comprehensive collision detection tutorial.