File: shit gaem.swf-(1.88 MB, 550x400, Game)
[_] question Anonymous 12/25/15(Fri)19:58:50 No.2984947
i have been working on learning how to use flash on my downtime for a little bit. file related is
just something i threw together that i will expand on as i learn more. one specific question i
have though is if you can trigger an event when two objects share the same space. ie. if i place
an object on the map (that moves along with the map of course), could i make an event listener
for the overlap of the black circle and the object?
tl;dr: event listener for two objects overlapping, how to? youtube doesn't have any tutorials on
this as far as i have seen
>> [_] Anonymous 12/25/15(Fri)20:00:39 No.2984949
i think maybe
>> [_] Anonymous 12/25/15(Fri)20:05:37 No.2984951
>>2984949
very helpful
>> [_] Anonymous 12/25/15(Fri)20:30:43 No.2984961
http://help.adobe.com/en_US/as3/dev/WS1ca064e08d7aa93023c59dfc1257b16a3d6-7ffe.html
this looks relevant.
>> [_] Anonymous 12/25/15(Fri)20:38:20 No.2984965
>>2984961
that's touchscreen shit. like if you wanted to make a smartphone app or something. not what im
looking for
>> [_] Anonymous 12/25/15(Fri)20:42:17 No.2984967
>>2984947
Hi OP and welcome to the wonderful world of flash.
Are you looking to detect visual collision between the black dot and another object, or are you
using a matrix of data for tile positions and want to check for overlapping that way?
>> [_] Anonymous 12/25/15(Fri)20:46:58 No.2984972
>>2984967
the "tiles" aren't even tiles. move around enough and you will see significant offset (not sure
if i want to fuck with the allignment or remove the tiles altogether). again, this file is really
a proof of concept.
in short: visual collision
>> [_] Anonymous 12/25/15(Fri)20:55:18 No.2984975
>>2984972
In that case you're looking for hitTest.
object1.hitTest(object2) returns a boolean, so you can use it in an if statement in your
onEnterFrame listener for a persistent check.
It's not the most elegant, but it will get you started as a beginner.
The main caveat is that it uses bounding boxes, meaning it draws a rectangle around your circle
shape and compares that rectangle to a rectangle drawn around the other object.
So for example if both objects are circles and you have them close to each other on a diagonal
line, but not touching, it would still register as a hit since the corners of the bounding boxes
extend beyond the circle.
There's another simple method of collision detection that uses a specific point rather than an
object1, it's hitTestPoint.
As you can imagine, it's much more precise since you don't have to deal with a bounding box for
object1, but it still uses the bounding box for object 2, and also you're really only comparing a
single pixel.
I wouldn't recommend it for objects that are in motion, either, since the point can easily pass
through the object it's supposed to be tested against without colliding if moving fast enough.
>> [_] Anonymous 12/25/15(Fri)21:11:46 No.2984985
>>2984975
>hitTestPoint
sounds a bit more like i want.
on that note; i would like to use this to trigger a random event when the dot is in each region
(the different colored areas). my idea is to make large, invisible objects on top of each region,
and when you press any movement button while on top of them, a random number will be generated
which will dictate the event that occurs. am i on the right track or is there a more elegant way
of doing it?
>> [_] Anonymous 12/25/15(Fri)21:13:26 No.2984987
>>2984975
>>2984985
to clarify, i want region specific events. not just events that happen any time you move.
>> [_] Anonymous 12/25/15(Fri)21:40:37 No.2984998
>>2984985
>>2984987
Are you thinking rpg random encounters based on color-coded zones?
In that case, yeah, hitTestPoint.
Just use dot.x and dot.y to set the coords for the point and test it against an array of the
possible zone-type objects in an array.
Here's an example, you'll just be using the dot instead of a cursor:
http://stackoverflow.com/questions/5567602/as3-hittest-any-object
If you have skype feel free to add me: codeultd
I've been working with actionscript for years and I know a couple people who are even more
knowledgeable than I that can answer your questions.
>> [_] Anonymous 12/25/15(Fri)22:02:24 No.2985017
>>2984998
>If you have skype feel free to add me: codeultd
i don't unfortunately. do you know of some good resources for this kind of information? youtube
isnt much help
>> [_] Anonymous 12/25/15(Fri)22:41:23 No.2985039
>>2985017
Google and stackoverflow, mostly.
If you have any form of communicating I can help you out with custom tailored examples, it's
always great to see a new face willing to learn.
>> [_] Anonymous 12/25/15(Fri)22:51:55 No.2985043
>>2984987
I think you'll need to do a collision test every time anything moves, maybe every loop, if your
game uses frame loops or something equivalent.
You can have a very simple fast method or function that is called every loop, then when that fast
method finds the right collision, it can call more complex methods that handle the collision.
I've made a lot of games as a hobby way back when Java Applets were a thing, and collision
detection has been around since the stone ages.
Many of these concepts can be used in any game language or framework, so you can find useful info
that's not directly related to Flash.
>> [_] Anonymous 12/25/15(Fri)22:58:59 No.2985048
>>2985039
i appreciate the offer, but i don't want to be tempted to bug you every time i have trouble with
something.
the essentials id like to learn are:
-how to implement traits like strength, stamina, etc. which i assume will consist of a variable
that increases/decreases based on certain actions and is checked for when certain other actions
are taken.
-health, mana, etc. which will probably work basically the same way.
-fights, which i assume will consist of "random number to determine enemy action, random number
to determine effectiveness, and random number between x and y for damage"
-inventory shit, which i guess will probly be a line of text with a button that, when pressed,
executes a given action
all seems very doable, i am just not familiar with the syntax to any real degree. the only
language i have considerable experience in is Toshiba PLC, which is absurdly simple compared to
other languages that i have had a minuscule amount of experience with
>> [_] Anonymous 12/25/15(Fri)23:05:51 No.2985054
You pretty much got the answer for the widest-case low level application.
You'll probably find all you need to get the job done in flash.utils.
Consider also using a 3rd-party game API like FlashPunk to simplify coding the thing.
http://useflashpunk.net/
>> [_] Anonymous 12/25/15(Fri)23:10:01 No.2985056
>>2985048
but I love being bugged ;_;
and yes, those are all variables
for the inventory you'll probably want to use an array
battles would ideally be object oriented class functions, but that will take you a while to build
up to
start with pong or something
>> [_] Anonymous 12/25/15(Fri)23:14:18 No.2985061
>>2985043
my motion is basically "press button to move map in the opposite direction"
as of right now, it's only two frames: the start screen and the map.
>>2985054
interesting. definitely considering it.
>>2985056
i plan on learning as much as possible from a single project. basically, i want to implement
something, check if it works, and basically treat the small steps in the creation of a large game
like i would treat finishing small games otherwise.
>> [_] Anonymous 12/25/15(Fri)23:40:52 No.2985072
>>2985061
I'm going to be brutally honest with you.
I work in the game development industry and get contracted for strike teams to do various bits
and bobs for full time teams that don't have time/skill required to get the job done.
In saying that, I think you're trying to get too far ahead of yourself. The design would be good
for someone with advanced knowledge in coding/scripting.
You seem to only know a little and I get that you're trying to learn as you go, but I feel like
you'd get more done by keeping the design simple.
We constantly try to tell dev teams that less is more because they often get devoured by scope
creep.
>> [_] Anonymous 12/25/15(Fri)23:49:33 No.2985081
>>2985072
>You seem to only know a little
to say that's an understatement would be an understatement.
i definitely understand the sentiment and i agree as far as professional shit is concerned, but
given that i dont have a contract or deadline to meet on anything, my main reason for doing
anything here is for learning's sake. i might start making smaller projects that apply relevant
knowledge if you're really convinced that will be the best way to learn, but this larger project
will still at least remain in the background to have shit applied to as i learn
>> [_] Anonymous 12/25/15(Fri)23:56:45 No.2985085
>>2985072
>>2985081
on that note: a list of actionscript commands and what they do would be invaluable to me. code
snippets helps a lot but doesn't have everything (my original question being an example). where
can i find such a thing?
>> [_] Anonymous 12/26/15(Sat)00:06:26 No.2985092
>>2985081
Ah I see it's a side project.
Yeah I know there's a lot of basic action script tutorials out there and you wanna know the more
industry relevant and advanced stuff.
It's a bit difficult when you haven't got anyone you know you can ask and can only research
online.
I remember when I did my degree in interactive entertainment that I had multiple tutors who got
me into various forums where I could ask all sorts of questions and have them answered.
Though that was in regards to unreal script and C++/C#
I'm sure there are forums out there you can sign up to that'll help you a lot better with action
script.
Good luck!
>> [_] Anonymous 12/26/15(Sat)00:08:13 No.2985093
>>2985085
You mean something like this?
http://www.cheat-sheets.org/saved-copy/Flash_ActionScript_quickref.pdf
Or
http://wdm3322.andrewwalpole.com/week1/AS3_Syntax.pdf
>> [_] Anonymous 12/26/15(Sat)00:13:53 No.2985094
>>2985093
these look great, thank you.
i feel like i understand the structure and logic of this game. i believe i can manage most
projects as long as i know what to type to make the thing happen
>> [_] Anonymous 12/26/15(Sat)00:21:02 No.2985097
>>2985094
No worries, at least this will give you a good idea of the terms used.
So when you go to a forum that discusses action script you can ask them using the relevant term
they'll know exactly what you mean and you should get a good answer.
Most of the time when nobody gets a reply it's because nobody understands what the person means
because they aren't using the correct industry terms.
All the best!