## game design – Enemy explosion offSet is displaced away from desired point of origin

In the game, when the enemy is hit and explodes the explosion animation appears offset to the bottom right corner of the dead enemy’s center point.

I ran tests to adjust the explosion positioning with no luck. The debugger says that “this.offSet.y” & “this.offSet.x” are -100. I can’t seem to know how to adjust that as well.

Image example:

Here are the code snippets & CSS for bonus:

Explosion JS

``````class Explosions {
constructor (assetName) {
this.count = 0;
this.offSet = undefined;
this.setOffSet(assetName);

}

setOffSet(assetName) {
let asset = GameManager.assets(assetName);
this.offSet = new Point ((asset.width/2)*-1, (asset.height/2)*-1);
}

createExplosion(position) {
let div = document.createElement("div");
let divId = 'explosion_' + this.count;
div.id = divId;
console.log(position);
div.style.left = (position.x + this.offSet.x) + 'px';
div.style.top = (position.y  + this.offSet.y) + 'px';
setTimeout(function() {
\$("https://gamedev.stackexchange.com/#" + divId).remove();
}, GameSettings.explosionTimeout);

this.count++;
}

}
``````

Explosion CSS

``````@keyframes explosion {
0%   {background-image: url("../../assets/explosion/smallexplode1.png");}
10%   {background-image: url("../../assets/explosion/smallexplode2.png"); }
20%   {background-image: url("../../assets/explosion/smallexplode3.png"); }
30%   {background-image: url("../../assets/explosion/smallexplode4.png"); }
40%   {background-image: url("../../assets/explosion/smallexplode5.png");}
60%   {background-image: url("../../assets/explosion/smallexplode6.png");opacity: 0.9;}
80%   {background-image: url("../../assets/explosion/smallexplode7.png");opacity: 0.8;}
90%   {background-image: url("../../assets/explosion/smallexplode8.png");opacity: 0.5;}
100%   {background-image: url("../../assets/explosion/smallexplode9.png");opacity: 0.3;}
}

.explosion {
width: 100px;
height: 100px;
position: absolute;
left: 500px;
top: 300px;
animation-name: explosion;
animation-duration: 0.8s;
background-repeat: no-repeat;
z-index: 20;
}
``````

Any indication what the cause is?

Let me know if there are any other snippets that needs adding, and if you can please be patient with me since I’m student programmer that is still learning.

Thank you

## list manipulation – How do you delete sublists of a desired permutation?

I have a list given as:

``````d = {{{A1,A2,T3}, {A4,T1,A2}, {T5,A1,A3}}, {{T1,T2,T3}, {A5,A1,A2},{A1,A2,T3}}}
``````

I’m trying to delete sublists of the type:

``````{A,A,A},{A,T,T},{T,T,T}
``````

that way I’m left with sublists consisting of only:

``````{A,A,T},{T,A,A},{A,T,A}
``````

I’m also trying to keep the numbers in list “d” so my desired outcome would look something like:

``````dd={{{A1,A2,T3},{A4, T1, A2}, {T5, A1, A3}},{{A1,A2,T3}}}
``````

I have tried the following:

`DeleteCases[d,{A,A,A}|{T,T,T}|{A,T,T},{2}]` but nothing seems to change. I think there’s an issue with my patterns in DeleteCases where I need to include additional information to exclude the numbers in list “d” and just delete the sublists based upon the criteria of the arrangement of the A’s and T’s.

## algorithms – Find a list of actions that result in desired state

I have a problem that I need to solve, and I’m looking for which area of computer science (algorithms. etc) would be appropriate to solve this problem.

In the system we have a list of actions that a user has previously taken. The possible actions are:

• User creates item of type A.
• User creates item of type B.
• User creates item of type C.

The date and time the action was taken is also recorded.

We have a function passesRules which takes the list of all actions the user has previously taken as input, and applies a set of rules and returns a boolean. The boolean is true if any of the rules are true, and false if none of the rules are true.

There are many possible rules, but in general they take the form of:

• Has user created 5 items of type A in the last 10 days?
• Has user created 2 items of type B in the last 3 days?
• Has user created more than 6 items of type C in last 5 days, AND
created 3 items of type A in the last 10 days?

What I want to do is to create a function predictActions which predicts the actions the user must take so that passesRules returns true.

Obviously with the rules described above there are multiple different sets of actions that could make passesRules return true. I would like predictActions to return an array where each element in the array is a list of actions the user could take to make passesRules return true.

predictActions should take the following parameters:

• The list of actions the user has previously taken.
• The list of rules.
• The current date.

I’m not asking for a solution, but I don’t know what area of computer science to investigate further to model and solve this problem. Something from graph theory, or some type of constraint solver?

Thanks!

## query – Problem using the “listagg” function to produce the desired result in Oracle PL-SQL

I’m working with `listagg` and I have a problem here. It does not give the desired result and I just do not know where the problem is .

The `deposit_query` might be like this :

``````sum (dep_balance) >1 and
sum (turnover)    >1 and
DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1
``````

or it might be like this (without sum):

``````DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1
``````

The desired result for first condition is :

``````DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1
group by customer_num
having sum (dep_balance) >1 and
sum (turnover)    >1 and
``````

and for second condition is :

``````DEP_BRANCH_COD     = -1 and
DEPOSIT_GROUP_DESC = -1 and
DEPOSIT_TYPE_DESC  = -1 and
CURRENCY_DESC      = -1
``````

What I’ve written so far is the query below and the problem is that the final result has the`Group by customer_num having` in the second condition.

``````declare

deposit_query varchar(1000) := 'DEP_BRANCH_COD     = -1,
DEPOSIT_GROUP_DESC = -1,
DEPOSIT_TYPE_DESC  = -1,
CURRENCY_DESC      = -1';
actual_query varchar2(1000);

begin

select listagg(case
when stm not like '%sum(%' then stm end,
' AND ') within group(order by stm)
||
listagg(case
when stm like '%sum(%' then stm end,
' AND ') within group(order by stm) || ' Group by customer_num HAVING '
into actual_query
from (select regexp_substr(deposit_query, '(^and)+', 1, level) STM
from dual
connect by regexp_substr(deposit_query, '(^and)+', 1, level) is not null);

dbms_output.put_line(actual_query);

end;
``````

I was wondering if you could tell me how to modify my query to have the desired result.

## simplifying expressions – step by step evaluation of rearranging algebra to desired form

Are there any functions on Mathematica that can rearrange equations to a desired form and show steps. It would output the working/steps required to change one equation to a desired form

for example:

After implicit differentiating this:

I get this, (where y=f(x)):

I would like Mathematica to convert the previous form to this form while showing steps:

Is there any function that would show a step by step algebra rearrangement from one form to another desired form?

## Linear algebra – solving an equation with exponents on the desired variable

I have this equation given $$1 = alpha ^ {(CW-1)} N$$ and this solution was given as $$alpha = N ^ { frac {-1} {CW-1}}$$.
I want to get the same expression for $$alpha$$ but i cant get it. I tried to solve it by taking a natural log (ln) on both sides and I get something like this
$$alpha = frac {-N} {CW-1}$$.

Can any organization tell what error I made and what steps should I take to get the right solution?

## javascript – Actions on screen do not indicate desired behavior (AngularJS)

Good morning all!
How are you
I have a problem with AngularJS.
This code snippet comes from a department responsible for recovering the password by email.
I intend to resolve the error but do not know where to start. The code was already ready.

`````` forgot: async (params) => {
var deferred = Q.defer()
var appData = {}
const pool = await poolPromise
if (pool) {
length: 6,
numbers: true
})
bcrypt.hash(password, salt, async (err, hash) => {
var user = await userService.getUserByMail(params.email)
.then((user) => {
element.datainicio = new Date(element.datainicio)
element.datainicio.setDate(element.datainicio.getDate() + 2)
});
})
if (user) {
var r = pool.request()
r.input('senha', sql.NVarChar, hash)
r.input('id', sql.Int, user(0).id)
await r.query('UPDATE users SET senha = @senha where id = @id')
if (!err) {
appData.error = 0
appData('data') = 'E-mail enviado com sucesso!'
deferred.resolve(appData)
try {
let mailOptions = {
from: '"Automed" ',
to: user(0).email,
subject: 'Automed - Acesso',
html: 'Olá ' + user(0).nome + ',Sua nova senha para acesso ao sistema é: ' + password + 'Ir para o AutomedFAVOR NÃO RESPONDER ESSA MENSAGEM.' // html body
}
let newdata = user(0)
newdata.senha = hash
auditService.insertAudit(user(0).id, "users", "Nova Senha", JSON.stringify(user(0)), JSON.stringify(newdata))
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
logger.error(error)
}

});
} catch (err) {
logger.error(error)
}

} else {
appData.error = 1
appData('data') = err
deferred.resolve(appData)
}

} else {
appData.error = 2
deferred.resolve(appData)
}
})

}
else {
appData('error') = 3
appData('data') = 'Internal Server Error'
deferred.resolve(appData)
}
return deferred.resolve()
}
``````

Can someone tell me what's wrong?

## Heavenly scents (feedback desired)

Hi all,

I started a candle business and wondered if I could get feedback from you, lovely people.

The website is new and I would love to see if there are any changes that I could implement or add.

Please don't just say that it is% ^ &

## dnd 5e – At what level are the desired spells copied launched?

The wish is a level 9 spell, one of the uses listed there is:

The basic use of this spell is to reproduce any other level 8 or lower spell. You don't need to meet the requirements of this spell, including the expensive components. The spell simply takes effect.

The question is at what level is this copy of the spell cast? I can see three possibilities here:

• The wish was cast from a level 9 spell slot, so the copied spell is cast at level 9.
• Wish can be cast up to a level 8 spell as a copy, so the copy cast is cast as if it were using a level 8 slot.
• The spell being copied is at level N, so the copy is launched as if it were using a slot at level N.

There are good reasons to cast low-level spells at higher levels, the additional die per level of healing to heal wounds, the additional missile per level for magic missiles, etc. a low level would generally be undesirable, but the fate of wish is unclear.

The first two possibilities make sense and are useful, in the example of the 9th level, you simply get the spell as if you had cast it normally in the slot, in the example of the 8th level, you sacrifice a casting bonus level for the ability to cast possibly unknown, unprepared or cross-class spells (no restrictions against copying cleric spells like a wizard with wish) – and this utility seems to be a fair compromise.

But which one is "officially" correct?