moving an object off the screen

Started by gollymrme, Thu 19/05/2011 17:56:34

Previous topic - Next topic

gollymrme

How would I move an object off of the screen? If my room is a busy street and the cars are the objects how can I get them to drive all the way off of the screen? Thanks for answering a green horns question in advance! Ryan

barefoot

#1
Move object to x y.. have it go off an edge  (eg  -1)

Eg:
Code: ags

object[2].Move(125, -3, 4, eNoBlock); // x,y, speed, blocking


This will move the object off the left hand edge by -3..

barefoot
I May Not Be Perfect but I Have A Big Heart ..

Khris

This won't work because by default, Object.Move sticks to walkable areas.
Not sure if using eWalkAnywhere is enough though but it might work.

barefoot

#3
Quote from: Khris on Thu 19/05/2011 18:18:35
This won't work because by default, Object.Move sticks to walkable areas.
Not sure if using eWalkAnywhere is enough though but it might work.

He says he is using cars, so one would presume he is using roads, which should be walkable..

This moves the object off the left edge (if no walkable area)

Code: ags

object[0].Move(-36, 130, 1, eNoBlock, eAnywhere);


But then it will take the shortest route which may go over other things unless it JUST uses x or y... As I said, the car should move along walkable areas and leave sceen.

This moves the object off the left edge (if walkable area)

Code: ags

object[0].Move(-36, 130, 1, eNoBlock, eWalkableAreas);


barefoot

I May Not Be Perfect but I Have A Big Heart ..

Khris

Quote from: barefoot on Thu 19/05/2011 18:30:42
He says he is using cars, so one would presume he is using roads, which should be walkable..

Right, but that's completely irrelevant.
No matter what he's using, you can't draw walkable areas outside the screen now, can you?
So to move an object outside the screen (more precisely: its bottom left corner) you must use eWalkAnywhere.

barefoot

#5
Yes, I quite agree Khris.... object move set to eAnywhere it will go off that edge..

:=

barefoot
I May Not Be Perfect but I Have A Big Heart ..

gollymrme

Thanks guys! I should have explained better. The player comes to a t in a city street and getting the cars going from the top of the screen to drive off the bottom and visa versa is the real problem I'm having. I don't know if that makes a difference. My cars start at the top and collect at the bottom of the screen instead of driving all the way off. I do appreciate you guy for helping me out!!!!!  Ryan

barefoot

Hi

Read the manual, particularly involving objects, check out other posts here, experiment. I'm sure you will get there.. good luck..

:=

barefoot
I May Not Be Perfect but I Have A Big Heart ..

Matti

In case objects can't move out of the screen use characters, they definitely can!

barefoot

#9
Quote from: Matti on Thu 19/05/2011 18:54:53
In case objects can't move out of the screen use characters, they definitely can!

I found out to my expense that you should make characters (cars) idle view the same as normal view to stop that dreaded idle view from rearing its ugly head if stationary to long... unless you want it to change of course...

barefoot

I May Not Be Perfect but I Have A Big Heart ..

gollymrme

Thank so much for trying to help!!!! I'll keep trying different things and see what works. I do appreciate you guys! Ryan

barefoot

gollymrme

As for reference I made a game like this in the past: roads, cars etc... with just mild moderate success... it was a learning curve for a green horned guy.... i may well do another in the future only this time better scripted and better game play... so don't give up...

:=

barefoot
I May Not Be Perfect but I Have A Big Heart ..

SMF spam blocked by CleanTalk