Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Collision and Detect Location
Old
mechanicarts
Guest
 
Status:
Posts: n/a
Default Collision and Detect Location - 04-11-2010, 08:50 AM

Hi, I am new both here and to Alice.

We have an assignment to make a game in Alice.

I chose to make an RPG, a basic one of course. I have several problems, since I don't really get how exactly things work in Alice. However, now I have two main problems.

Collision. My hero should not be able to walk through houses and fences. I have seen several collision detection examples in here, but I don't really get the hold of them, so I cannot manage the code into my project. The one that I really need is King Gamer's, with the two squares, but it has so many "boths" I don't get anything

Detection. I created a 3D text (holding the string "Place") and placed it on top-right of the screen, to display the current location. I also added a plane (square) under the whole "village" and added a method to the world which contains the following code.

If "Hero" is within 5 meters of "LocationDetector1"
Set 3D text to "Clearwater Village"

However the text always remains "Place"!

If you can help me with any of these, I'd be most grateful. And you'd probably hear more from me soon

Last edited by mechanicarts; 04-11-2010 at 09:29 AM.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 12:26 AM

What I do when things like this happen is I use 'print' to make sure/find out if something is running properly and where something isn't running properly. Basically, print is mainly used for debugging and just places the text you've entered in an output menu below the world.
   
Reply With Quote
Old
mechanicarts
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 09:13 AM

Quote:
Originally Posted by Niteshifter View Post
What I do when things like this happen is I use 'print' to make sure/find out if something is running properly and where something isn't running properly. Basically, print is mainly used for debugging and just places the text you've entered in an output menu below the world.
Still, I don't have a bit of knowledge from "real" programming so I wouldn't understand anything. Should I "print" it so that you can check the code?
   
Reply With Quote
Old
madden
Senior Member
 
madden's Avatar
 
Status: Offline
Posts: 322
Join Date: Mar 2006
Location: My own little world 0.0
Default 04-12-2010, 02:02 PM

Quote:
Originally Posted by mechanicarts View Post
Hi, I am new both here and to Alice.

We have an assignment to make a game in Alice.

I chose to make an RPG, a basic one of course. I have several problems, since I don't really get how exactly things work in Alice. However, now I have two main problems.

Collision. My hero should not be able to walk through houses and fences. I have seen several collision detection examples in here, but I don't really get the hold of them, so I cannot manage the code into my project. The one that I really need is King Gamer's, with the two squares, but it has so many "boths" I don't get anything

Detection. I created a 3D text (holding the string "Place") and placed it on top-right of the screen, to display the current location. I also added a plane (square) under the whole "village" and added a method to the world which contains the following code.

If "Hero" is within 5 meters of "LocationDetector1"
Set 3D text to "Clearwater Village"

However the text always remains "Place"!

If you can help me with any of these, I'd be most grateful. And you'd probably hear more from me soon
Well, as for the collision detection problem. I have many solutions... Lets say your square is the object you want collision on (The object you use to move around your world), and lets also say that you use the "Up arrow key do 'Square move 5 meters forward" to move your square. The most basic Collision detection method is "If Square is within - 5 (Or however many you need) meters, then Square move backwards - 5 meters". This is he simplest way to do it. If you need something more complicated then that just let me know.


Check out my new website - http://www.freewebs.com/maddenuser/

Special thanks to the people who are supporting me...
Drjim, rich0e0rick, Chris101b, ZED, jediaction, x2495iiii, ("Robby"), gabe, JustasM, and Shadow Sovereign.


Games...

CSS - a sidescroler/adventure game.
CASE 1.01 - a escape the room/adventure game.
In the Black and White - a shooter/adventure game.
Field Of Wonder - a adventure game
C.R.E.S - a action/adventure game.

Can you eat 10 cookies in 5 seconds?
I did.
   
Reply With Quote
Old
mechanicarts
Guest
 
Status:
Posts: n/a
Default 04-12-2010, 03:39 PM

Well this is what came to my mind first, but I'd like something like real collision. I mean, not send back the Hero, but rather disallow movement towards the obstacle. The only way I can think of doing that is by disallowing movement completely which is not what we want to do eh?

Do you have any idea for my "Detection" problem?
   
Reply With Quote
Old
mechanicarts
Guest
 
Status:
Posts: n/a
Default 04-16-2010, 08:25 PM

Bump.

Sorry people, I really need an answer to this.
   
Reply With Quote
Old
Niteshifter
Guest
 
Status:
Posts: n/a
Default 04-17-2010, 02:39 AM

There is a way to disallow movement rather than move the player back, but it requires prior knowledge in recursion, multi-threading and coroutines (collaborative multi-threading) as well as knowledge on memory handling (depending on the amount of moving objects there are) which are fairly advanced topics. I might release a coroutine demo soon since it could be useful for people making games (if they know how to use this method properly).
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2017, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.