Code edit (1 edits merged)
Please save this source code
User prompt
delete all movement of box
Code edit (5 edits merged)
Please save this source code
User prompt
if swipe is longer than 100 pixels move box
User prompt
add move touch movemet to box
User prompt
add move to box class
Code edit (1 edits merged)
Please save this source code
User prompt
move no asset 400 pixels belwo the box. centered
Code edit (1 edits merged)
Please save this source code
User prompt
on swipe up, box should move up
User prompt
on double click destroy box
User prompt
Fix Bug: 'TypeError: box.open is not a function' in this line: 'box.open();' Line Number: 66
Code edit (1 edits merged)
Please save this source code
User prompt
Fix Bug: 'TypeError: box.open is not a function' in this line: 'box.open();' Line Number: 66
User prompt
on swipe box should move
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'self.vx = finalTouchPosition.x - self.initialTouchPosition.x;' Line Number: 37
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'x')' in this line: 'self.vx = finalTouchPosition.x - self.initialTouchPosition.x;' Line Number: 40
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in this line: 'var finalTouchPosition = obj.event.data.getLocalPosition(self.parent);' Line Number: 34
User prompt
Fix Bug: 'TypeError: Cannot read properties of undefined (reading 'getLocalPosition')' in this line: 'self.initialTouchPosition = obj.event.data.getLocalPosition(self.parent);' Line Number: 29
User prompt
on swipe box should start moving on the direction of the swipe
User prompt
add movement to box
User prompt
create another instance of messagedisplay called no.
User prompt
create another instance of messagedisplay with an asset called yes
Code edit (1 edits merged)
Please save this source code
User prompt
show yesorno asset in assetdisplay, 400 pixels on top of box
===================================================================
--- original.js
+++ change.js
@@ -14,44 +14,8 @@
});
var Box = Container.expand(function () {
var self = Container.call(this);
var boxGraphics = self.createAsset('box', 'Box Graphics', .5, .5);
- self.vx = 0;
- self.vy = 0;
- self.isSwiped = true;
- self.lastDownTime = 0;
- self.on('down', function (obj) {
- var currentTime = Date.now();
- if (currentTime - self.lastDownTime < 300) {
- self.destroy();
- }
- self.lastDownTime = currentTime;
- if (obj.event && obj.event.data) {
- self.initialTouchPosition = obj.event.data.getLocalPosition(self.parent);
- self.isSwiped = true;
- }
- });
- self.on('move', function (obj) {
- if (obj.event && obj.event.data && self.isSwiped) {
- var moveTouchPosition = obj.event.data.getLocalPosition(self.parent);
- self.vx = moveTouchPosition.x - self.initialTouchPosition.x;
- self.vy = moveTouchPosition.y - self.initialTouchPosition.y;
- self.initialTouchPosition = moveTouchPosition;
- }
- });
- self.on('up', function (obj) {
- if (obj.event && obj.event.data) {
- var finalTouchPosition = obj.event.data.getLocalPosition(self.parent);
- if (self.initialTouchPosition) {
- var swipeDirectionY = finalTouchPosition.y - self.initialTouchPosition.y;
- var swipeDistance = Math.sqrt(Math.pow(swipeDirectionY, 2) + Math.pow(finalTouchPosition.x - self.initialTouchPosition.x, 2));
- if (swipeDirectionY < 0 && swipeDistance > 100) {
- self.vy = swipeDirectionY;
- self.isSwiped = true;
- }
- }
- }
- });
});
var Kitty = Container.expand(function () {
var self = Container.call(this);
var kittyGraphics = self.createAsset('kitty', 'Kitty Graphics', .5, .5);
8-bit. cartoon. red button. do not touch! Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. black tub stopper with chain. in game asset.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
8-bit. cartoon. axe. in game asset. no shadow.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Break in case of emergency square. Ax drawing inside. simple. 8-bit. cartoon. blackand white.. Single Game Texture. In-Game asset. 2d. Blank background. High contrast. No shadows.
Delete