• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Simple Drag + Drop Game - Need to use HTML5?

New Here ,
Aug 30, 2021 Aug 30, 2021

Copy link to clipboard

Copied

Hi there. I'm a total n00b looking for some help. I used to make really simple dress up games in Flash 2017 in actionscript 3 .fla - > .swf for web. These games just had the clothes be draggable - not even snapping into place - and I had a back/forth button to change the hair, the doll's expression changed if you hovered over it. I want to make the same thing again but Flash is dead now. If I can still make it in actionscript then I know how to make it but not to export it as something functional ..but I think you can't? so it seems HTML5 is the thing I have to do now? 

I've been googling and reading and watching tutorials but I can't seem to figure it out..they all seem to be making something too different. I'm also confused as to what kind of file I should be trying to export the game as. Any code snippets/help/advice is so so appreciated. Thank you.

Views

65

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 31, 2021 Aug 31, 2021

Copy link to clipboard

Copied

LATEST

var this_var = this;

function initF(){
for(var i=1;i<=15;i++){
this_var['pz'+i].addEventListener('pressmove',startDrag2F);
this_var['pz'+i].addEventListener('pressup',stopDrag2F);

this_var['pz'+i].addEventListener('pressup',stopDrag2F);

this_var['pz'+i].startX = this_var['pz'+i].x;

this_var['pz'+i].startY = this_var['pz'+i].y;
}
}
function startDrag2F(e){
var img = e.currentTarget;
img.parent.addChild(e.currentTarget);
img.x = e.stageX;
img.y = e.stageY;
}
function stopDrag2F(e){
var hit = false;
for(var i=1;i<=15;i++){
var p = this_var['t_grid'+padF(i)].globalToLocal(e.stageX, e.stageY);
if(e.currentTarget.hitTest(p.x,p.y)){
e.currentTarget.x = this_var['t_grid'+i].x;
e.currentTarget.y = this_var['t_grid'+i].y;
hit = true;
break;
}
}
if(!hit){
e.currentTarget.x = e.currentTarget.startX;
e.currentTarget.y = e.currentTarget.startY;
} else {
//checkForEndF();
}
}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines